I created an HTML file on my desktop and added some JavaScript to set and clear cookies.
Now my question is, will the cookie be saved in my browser? Can I read it back?
if Yes,
For which domain will it be saved?
How can I see it in Google Chrome? (HTML run on Chrome)
Unfortunately some browsers including Google Chrome do not store cookies from local web pages:
Why does Chrome ignore local jQuery cookies?
Firefox has great developer plugins for cookie management, which report their domains, access paths and expiry:
https://addons.mozilla.org/en-US/firefox/addon/view-cookies/
https://addons.mozilla.org/en-US/firefox/addon/firecookie/ (Personal Favourite - Requires FireBug)
For local development purposes you can setup a development domain like "localhost" or "myfakedomain.com" and run your files on a local server.
Search:
Editing Hosts File [operating system]
Setup Local server on [operating system] (I use xampp)
If you're running the 'site' on a local webserver then it should be stored in your browser under 'localhost'. If however you're just opening a static HTML file Chrome will not store the cookie.
In Chrome you can use the Chrome Developer Tools and look under the 'Resources' tab.
Related
I store some info in cookies in my Javascript code. I have had no problem to set and read them from local drive until Firefox Quantum installed.
Now it seems that the cookies are set (been checked among the cookies), but cannot be read if I open the html file. The document.cookie.length value is always zero. Yet if I set the cookies and refresh the browser (or open the file again not closing the first file) the cookies can be read.
So far Firefox stored and read cookies all right using file:///, but this twist is new for me. Some setting has to be changed, I guess.
Can anybody tell me a solution, how to allow to read the cookies again from local drive?
Thank you.
Firefox Quantum (as with Google Chrome and others) has disabled storing cookies for local files due to security issues and other problems. The HTML5 web storage commands are taking over what used to be done with cookies for both server and local web pages. See "https://www.w3schools.com/html/html5_webstorage.asp"
I prefer to work in Google Chrome but it doesn't save my cookies of a project I'm working on right now.
When I open the (local) path in Safari the cookies will be stored correctly but Chrome doesn't save them.
How do I allow cookies of projects directly accessed from my hard-drive? Adding the exact local path to Chromes cookie settings won't work.
I thought about something like files:///[*], but it wouldn't work out for me.
This is a pretty general question with a couple examples. I'm fairly new to writing chrome extensions and I seem to keep running into cases that are impossible to test without deploying to the webstore (which takes ~60m each time). This is an impossible workflow. Am I missing something?
Case 1 inline installation
Trying to set up inline installation from my site to a chrome extension. When I run the site locally i get the following.
Error downloading extension: Inline installs can only be initiated for Chrome Web Store items that have one or more verified sites.
But I cannot seem to add localhost website property in chrome's developer dashboard. What is the recommended way to do this in a dev environment. I tried using local.mywebsite.com and adding a local alias for localhost, but now chrome cannot find the verification file you are required to serve...
Case 2 Chrome Extension OAuth
Attempting to use chrome.identity.launchWebAuthFlow to setup user credentials in my extension for my website, but of course the callback url provided https://<ext-id>.chromium.org/provider-cb does not redirect to my local deploy of the extension.
Is there no way to test these things??
Regarding your error "Inline installs can only be initiated for Chrome Web Store items that have one or more verified sites.", you may follow the instructions given in this page.
You need to:
Go to the Webmaster Tools.
Add the site to your sites.
Obtain and embed a verification code into your site.
Complete verification in Webmaster Tools.
Go to your Developer Dashboard (must be under the same Google account) and edit your Web Store item.
Select your site in "Verify that this is an official item for a website you own:"
Here are some references which might help in testing extensions:
Testing browser extensions
How to test chrome extensions?
I have created html page using dreamweaver software.
I don't get list of properties of localStorage/SessionStorage in developer tools in IE11 browser.
On debugging www.google.com, I get all these properties but not getting on my html page.
Please do the needful.
localStorage won't work with a file:// URL.
You need to view your your Dreamweaver page with an http:// URL.
You could publish the page to a real server. Or you could set up a server on your local computer. Here are a couple of ways that I have used:
Enable IIS on your computer. Control Panel > Turn Windows features on or off > Internet Information Services > World Wide Web Services . Don't enable FTP Server. Then, Computer > Manage > Services and Applications > Internet Information Services > Sites . Then add a site, with Bindings to localhost:81 and Basic Settings to point to the root of your Dreamweaver project. Now you can view your page as http://localhost:81/mypage.html.
Install Microsoft Expression Web (a free alternative to Dreamweaver) and view the page from within Expression Web using its built-in Development Server feature. The software starts up a little webserver in the background, bound to a port on localhost. (FWIW, It even supports PHP.)
I'm creating a mobile application (For IOS, Android) and I first develop it in my browser. I need to use the local storage. I understand that local storage is working for a specific domain (A bit like cookies). The thing is that now when I'm working on the development server I have a domain and local storage is working correctly. What i'm a bit worried is that when I move to Phonegap and run the files locally I might not have access to local storage as there is no domain (a bit like not having cookies when you develop on an IP instead of a domain).
I know that phonegap has it's own storage but I rather not use it now as it's web sql based which is depricated as far as I understood by researching).
So, if the HTML files are local in the Phonegap webview application (not opened from a remote server, but stored locally) can I still use the local storage?
Thanks.
LocalStorage works just fine in a PhoneGap/Cordova app.