local-files

Loading local file in WKWebView doesn't working in device

北战南征 提交于 2020-05-29 07:40:23
问题 I can't load local epub file (from document directory) in wkwebview. It's working in simulator but not in device. I learned that it's a bug for iOS 8 from here. Is it already solved for iOS 8 ? Please help me what should i do. I got error in device as - The operation couldn't be completed. (KCFErrorDomainCFNetwork error 1.) Here is code snippet - -(void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self.webView removeObserver:self forKeyPath:@"loading"]; [self

AJAX GET not working with local JSON file?

别说谁变了你拦得住时间么 提交于 2020-01-13 06:02:07
问题 I had a JSONP URL, that was pulling data and just switched to a local JSON file and now I am getting errors. I don't understand why it is not working with a local JSON file? <script type="text/javascript"> $.ajax({ type : 'GET', dataType : 'json', url: '/json/topics.json', success : function(data) { console.log(data); var topics = []; $.each(data.results, function(index, obj){ topics.push({ username: obj.TopicName, mentions: obj.LastHourCount, totalcount: obj.TotalCount, daycount: obj

Why is FileReader.readAsText() returning null?

时光怂恿深爱的人放手 提交于 2020-01-06 12:42:32
问题 I am trying to read a file in the same directory of an HTML and JavaScript file however it seems to be returning null. Below I have added the code I have from each file. HTML File: <html> <!-- Code to call the Google Maps API and link style.css sheet --> <body> <div class="content"> <div id="googleMap"></div> <div id="right_pane_results">hi</div> <div id="bottom_pane_options"> <button onclick="get_parameters()">Try It</button> </div> </div> </body> <script type="text/javascript" src=".

Check if a file exists locally using JavaScript only

泄露秘密 提交于 2019-12-28 06:19:08
问题 I want to check if a file exists locally, where the HTML file is located. It has to be JavaScript. JavaScript will never be disabled. jQuery is not good but can do. By the way, I am making a titanium app for Mac so I am looking for a way of protecting my files from people who click "show package contents". 回答1: Your question is ambiguous, so there are multiple possible answers depending on what you're really trying to achieve. If you're developping as I'm guessing a desktop application using

Accessing Local Files with jQuery

心已入冬 提交于 2019-12-25 11:53:41
问题 I believe that this question has been asked in a few different forms, but I've read quite a few different responses. At first, I had a web-application written with mostly jQuery that would make use of servlets to retrieve information from various locations JavaScript could not access (ie. Feeds, images from a server, etc.). Now, however, I've been told to do away with the servlets and application configuration classes so that this project of mine contains only HTML, CSS, and JavaScript/jQuery

jQuery $.ajax run as a local HTML file avoiding SOP (same origin policy)

倖福魔咒の 提交于 2019-12-24 19:06:58
问题 I created an HTML file foo.html with the following contents: <script src="http://code.jquery.com/jquery-1.8.3.js"></script> <script> $.ajax({url:"http://foo.com/mdata", error: function (results) { alert("fail"); }, success: function (result) { alert("sucesses"); } }); </script> When I load this HTML file in the web browser it always shows a dialog box with fail. Any idea why this is happening? Also what is the best way to debug this? PS: Assume that http://foo.com/mdata is a valid web service

window.open to open local image,pdf on windows platform using InAppBrowser

谁说胖子不能爱 提交于 2019-12-23 15:44:40
问题 I am working on cordova based hybrid application targeted to Windows 8.1 platform with InAppBrowser plugin added. I have used following code to open local image/pdf file: window.open("Screenshot.png", "_blank", "location=no"); But it does nothing...no exception and no image. I am able to use the same code to open text file. But the same code does not work with image/pdf/word/excel documents. Any help will be much appreciated. Thanks, Chirag. Update: I found solution. Following is the sample

How to enable loading local file using ajax in IE9

无人久伴 提交于 2019-12-23 09:43:51
问题 I know there is the origin problem, but setting up a web server is not an option here. Firefox v14 has no problem loading a local file. Chrome has no problem after adding '--allow-file-access-from-files' Is there any way to fix also IE9? Thank you Edit: I figured out the solution. Just use ActiveXObject("MSXML2.XMLHTTP.6.0") instead of XMLHttpRequest() for IE9 to overcome the local file access deny problem. 回答1: Ajax or not. HTTP is a client-server application protocol. Without a server, that

How to run local program (exe) via Chrome via HTML/javascript

荒凉一梦 提交于 2019-12-20 10:14:46
问题 I am trying to build a (single page) local portal in Chrome that opens several things. The problem is we want to run a local executable via a button on a (local) webpage. Is this possible? The second thing is that i want to do is to run a .pps file directly in the powerpoint viewer. I can control to the startup of chrome, so i can access local files. All things i tried so far only made the file(s) to download, not to run. Can somebody help me how i get this done? 回答1: You can set a protocol

JQuery.getJSON() reading a local file

无人久伴 提交于 2019-12-17 20:50:00
问题 How do you read a file in the current directory using JQuery.getJSON()? I'm trying something simple (with my data.json file in the same directory as my html file): $.getJSON("./data.json") and I get the error: XMLHttpRequest cannot load file:///C:/Projects/test/data.json. Origin null is not allowed by Access-Control-Allow-Origin. I've tried all sorts of combinations of path, but it doesn't seem to work... EDIT: I'm using Chrome, but I'd like to work in all browsers... 回答1: If you are using