Reputation: 41
I have been trying to get my head around how to use cookies on a webpage, and on a webpage designed to test cookies I have been consistently been unable to read a cookie, despite apparently being able to make and delete them. I would like to know if cookies only work on webpages stored on servers, as I have been using the functions from http://www.quirksmode.org/js/cookies.html , which seems to be recommended by many people so I doubt the code is at fault. Can anyone help me with this query?
Thanks in advance,
Vulcan
Upvotes: 2
Views: 87
Reputation: 762
By default, no they do not. But you can have Chrome browsers support "File" cookie by passing the option:
--enable-file-cookies
...into the startup command. (i.e. the windows shortcut that starts your chrome browser).
In windows, I also setup a shellext to do this for me, so that I only need to right-click on the file in File Explorer to launch chrome with the option.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\Shell\Open with GoogleChrome64]
[HKEY_CLASSES_ROOT\*\Shell\Open with GoogleChrome64\command]
@="{path to 64bit chrome.exe} --enable-file-cookies \"%1\""
[HKEY_CLASSES_ROOT\*\Shell\Open with GoogleChrome32]
[HKEY_CLASSES_ROOT\*\Shell\Open with GoogleChrome32\command]
@="{path to 32bit chrome.exe} --enable-file-cookies \"%1\""
If you want to use this approach, copy and paste the text above into a plain-text editor (notepad), replace the location to your 32bit and 64bit chrome.exe location. Save the file as openwithchrome.reg then double click that file via File Manager. That will add the necessary bit to your registry that will allow you to right click on a file and choose which browser you want to open the file with.
If instead you want to edit your startup icon, right click the icon and choose "Properties". In the "Target:" box, after the .exe (which is already on the target line) add the option in quotes:
{path}chrome.exe "--enable-file-cookies"
...click Apply then OK. When you start via that shortcut it should work for you.
Upvotes: 2