local-files

Run Greasemonkey on html files located on the local filesystem?

拥有回忆 提交于 2019-11-28 22:19:15
问题 I have an API documentation lying around on my Harddrive and to ease my workflow, I have written a simple script that modifies the page for my needs. I've developed it using FireBug on FireFox. @include -ing webpages works correctly, but Greasemonkey does not seem to detect pages on the local file-system? I would like to have an include like // @include *R13/Python*R13/* Which should match for example file:///Z:/Eigene%20Dateien/Cinema4D/Documentations/R13/Python%20R13/modules/c4d/index.html

JQuery.getJSON() reading a local file

懵懂的女人 提交于 2019-11-28 13:48:13
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... If you are using Google Chrome, it is intentional that AJAX on file:/// paths never works. crbug/40787 This is because you're

Read file names in a local folder in an HTML page

天大地大妈咪最大 提交于 2019-11-28 13:07:11
I am creating a HTML page where I need to display the names of the files present in the specific local folder, example - C:\Users\User1\Documents\folder1 . I tried to write the code in java script but have not succeeded yet. Most of the question threads mention about "ActiveXObject" to be used but that itself does not work for me. Reference: JavaScript: Read files in folder Can anyone help me in achieving this? duskwuff In general, you can't do that. Web pages do not have access to the local filesystem. Chrome can access the contents of a directory that is selected using a file input field.

Check if a file exists locally using JavaScript only

落花浮王杯 提交于 2019-11-27 22:54:07
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". dSebastien 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 Titanium, then you can use the FileSystem module's getFile to get the file object, then check if

Setting Cookies using JavaScript in a local html file

懵懂的女人 提交于 2019-11-27 19:19:02
I have the following directory tree: + folder1 |--- folder2 |------ page1.html |--- page2.html If I set some cookie in page1.html using JavaScript, what is the path used for that cookie? Edit: Let me explain it better. I'm working with a local file. page1.html is being accessed through /home/user/.../folder1/folder2/page1.html and not through a client machine using a HTTP Server. Just to clarify: It seems that some browsers (like Chrome) do not store cookies when using file:/// , but both Firefox and Internet Explorer do. From the MDC page for document.cookie : If not specified, [the path

How to fetch data from local JSON file on react native?

时光毁灭记忆、已成空白 提交于 2019-11-27 17:46:40
How can I store local files such as JSON and then fetch the data from controller? peter Since React Native 0.4.3 you can read your local JSON file like this: const customData = require('./customData.json'); and then access customData like a normal JS object. ES6/ES2015 version: import customData from './customData.json'; For ES6/ES2015 you can import directly like: // example.json { "name": "testing" } // ES6/ES2015 // app.js import * as data from './example.json'; const word = data.name; console.log(word); // output 'testing' If you use typescript, you may declare json module like: // tying.d

Read file names in a local folder in an HTML page

陌路散爱 提交于 2019-11-27 07:27:42
问题 I am creating a HTML page where I need to display the names of the files present in the specific local folder, example - C:\Users\User1\Documents\folder1 . I tried to write the code in java script but have not succeeded yet. Most of the question threads mention about "ActiveXObject" to be used but that itself does not work for me. Reference: JavaScript: Read files in folder Can anyone help me in achieving this? 回答1: In general, you can't do that. Web pages do not have access to the local

Play audio local file with html

末鹿安然 提交于 2019-11-27 05:20:21
I'm trying to do something like this . But I don't know why I'm not getting this thing work. Here it is the codepen example : $('input').on('change', function(e) { var file = e.currentTarget.files[0]; var reader = new FileReader(); reader.onload = function(e) { $('audio source').attr('src', e.target.result); } reader.readAsDataURL(file); }); The source tag is receiving the base64 mp3 file, but it doesn't load the file into browser. You set the src attr directly on the audio element. fiddle var $audio = $('#myAudio'); $('input').on('change', function(e) { var target = e.currentTarget; var file

Setting Cookies using JavaScript in a local html file

对着背影说爱祢 提交于 2019-11-27 04:21:55
问题 I have the following directory tree: + folder1 |--- folder2 |------ page1.html |--- page2.html If I set some cookie in page1.html using JavaScript, what is the path used for that cookie? Edit: Let me explain it better. I'm working with a local file. page1.html is being accessed through /home/user/.../folder1/folder2/page1.html and not through a client machine using a HTTP Server. Just to clarify: It seems that some browsers (like Chrome) do not store cookies when using file:/// , but both

Using Jquery to get JSON objects from local file

。_饼干妹妹 提交于 2019-11-27 01:55:11
问题 I'm trying to get a list of JSON objects (products) from a local file using Jquery and store all the objects in a single array called allItems. The file is co-located in the same directory as the code, and it's called "allItems.json". Here's how I'm doing it now: function getAllSupportedItems(){ var allItems = new Array(); $.getJSON("allItems.json", function(data){ $.each(data.items, function(item){ allItems.push(item); }); }); return allItems; } Based on this example: http://api.jquery.com