Open local folder using tampermonkey - javascript

I am well aware that local file access is severely restricted if not outright impossible in modern browsers.
However, what I wonder, is if it would be possible to actually use tampermonkey with "allow access to file urls" extension option enabled to bypass this restriction? If so, how can I attempt it? I tried using local filepaths in several variants (\\\\, file://) but it doesn't seem to work, and I couldn't find any relevant information in the web either.
//edit//
I want to open local folder in system file explorer.

Related

Strange behaviour of onAuthStateChanged() when persistence is set to local [duplicate]

I am creating 2 HTML files that will be stored an an iPhone locally and accessed through a WebView.
I am wondering if it is possible to set localStorage in one file, and get the results of the storage from the other file.
I know that localStorage is accessible from files on the same domain, however, it appears that you can not get the value from a different local file?
I have also tried running this in Safari on the desktop with local files and the same issue occurs.
When you are opening the files locally, i.e. using the file:// protocol, as of now the browsers can not determine what is "same domain" so every file is considered a separate domain. Thus you can not use localStorage when you're opening the files.
Here is some more information on the problem in FireFox: https://bugzilla.mozilla.org/show_bug.cgi?id=507361 . Personally I couldn't find much about Safari on this topic.
You can also look over this: Javascript/HTML Storage Options Under File Protocol (file://) . It might be helpful in your situation.
At this time, local files rendered via WKWebView on iOS 10 share access to the "same domain" with respect to localStorage. Unclear whether this is by design or a bug, however.

LOCALSTORAGE not working offline. Works fine on a live-server [duplicate]

I am creating 2 HTML files that will be stored an an iPhone locally and accessed through a WebView.
I am wondering if it is possible to set localStorage in one file, and get the results of the storage from the other file.
I know that localStorage is accessible from files on the same domain, however, it appears that you can not get the value from a different local file?
I have also tried running this in Safari on the desktop with local files and the same issue occurs.
When you are opening the files locally, i.e. using the file:// protocol, as of now the browsers can not determine what is "same domain" so every file is considered a separate domain. Thus you can not use localStorage when you're opening the files.
Here is some more information on the problem in FireFox: https://bugzilla.mozilla.org/show_bug.cgi?id=507361 . Personally I couldn't find much about Safari on this topic.
You can also look over this: Javascript/HTML Storage Options Under File Protocol (file://) . It might be helpful in your situation.
At this time, local files rendered via WKWebView on iOS 10 share access to the "same domain" with respect to localStorage. Unclear whether this is by design or a bug, however.

localStorage access from local file

I am creating 2 HTML files that will be stored an an iPhone locally and accessed through a WebView.
I am wondering if it is possible to set localStorage in one file, and get the results of the storage from the other file.
I know that localStorage is accessible from files on the same domain, however, it appears that you can not get the value from a different local file?
I have also tried running this in Safari on the desktop with local files and the same issue occurs.
When you are opening the files locally, i.e. using the file:// protocol, as of now the browsers can not determine what is "same domain" so every file is considered a separate domain. Thus you can not use localStorage when you're opening the files.
Here is some more information on the problem in FireFox: https://bugzilla.mozilla.org/show_bug.cgi?id=507361 . Personally I couldn't find much about Safari on this topic.
You can also look over this: Javascript/HTML Storage Options Under File Protocol (file://) . It might be helpful in your situation.
At this time, local files rendered via WKWebView on iOS 10 share access to the "same domain" with respect to localStorage. Unclear whether this is by design or a bug, however.

JavaScript read file contents

how can you retrieve the data from a document with javascript that isn't the page you are on if you have the url of the new document.
what i am trying to do is create a page that has a text field for providing a local file name and a button that retrieves the words from the document provided.
thanks.
HTML5 has a File API that lets you read local files. It's supported in at least Firefox (3.6 and later, I think) and Chrome. I don't know if any other browsers support it yet or not. If you need to support other browsers, you'll have to fall back to something like Flash, but I don't have any experience with that.
Unfortunately, by default Chrome doesn't allow local files to access other local files (each file is considered to be from its own domain). You can explicitly allow it by adding the --allow-file-access-from-files flag when you launch Chrome.
Here's a good introduction to the File API with several examples: http://www.html5rocks.com/en/tutorials/file/dndfiles/.
Browser security does not allow direct access to the local filesystem. If it could, web pages would be able to steal any file of your machine.
HTML5 local storage does allow local access, but on a different principle.

Access local files from HTML5 Desktop Application in html folder

HTML5 is great and I can replace my existing desktop application with it, but just a little security restriction prevents me to complete my job. I plan to create a simple desktop application completely with HTML5 so it can run on any mobile and desktop devices that support HTML-5.
I know about the browser security on local file and the reason behind it, but I don’t know why I couldn’t find a way to grant read-only access to a folder as sandbox. My application does not need to write a file or even does not need to read a file outside of It main html folder. It needs to read the local file just in same folder same as it do on domain.
So please let me know:
Can run browser with specific command to force it grant access to local file that exists in same folder of HTML? It should not disable all local security restriction just grant HTML access to file in same folder or subfolder.
Is it cross platform method to map a local folder as local host that work on mobile platforms?
Is there any manifest file exists to put in folder to grant read access in same HTML folder?
Is there any way to grant read-only access to a folder as sandbox?
Note: I don't want use third party solution such as XULRunner, Mozilla Prism, Adobe Air or any other third party, I need HTML-5 solution to be cross platform if there is any.
Any idea is welcome.
If you need that file so much, why not just load it dynamically inside a JS script as a json object.
So, in other words, put the contents of the file into a js script, and strucutre the file contents into JSON format, then load that script on load or when you require it.
Alternately if you need file IO use localstorage.
according to this site, launching chrome from the cmd with the parameter --allow-file-access-from-files will disable this security feature

Categories

Resources