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

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.

Related

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.

Open local folder using tampermonkey

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.

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.

Javascript accessing a local file on computer

is there a way to allow a domain access a file which is stored on my computer?
I wish to inject javascript a tag into a website, with the source as a file stored on my computer. This works within a local test.html page, but not when trying to run the script on an actual domain.
Is there a way to set this up my changing window's host file?
Edit - it MUST work in IE
Clarification :: I wish to use javascript injection (using the javascript: protocol) to manipulate the DOM within IE, this is fine. There is however an 8k byte limit within the address bar, which isn't enough. Therefore I wish to store it within a local file on my computer.
Instead of storing it on your computer you could store it online and then load the Javascript through a much smaller amount of code in the address bar.
It's explained how to do this here
http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
Try the file API if you're on a recent browser. https://developer.mozilla.org/en/using_files_from_web_applications
If not and you're on IE, you should be able to do it with ActiveX but it'll always ask for permission.

Categories

Resources