Solved

Why does Chrome browser not save to a cookie from off-line HTML/Javascript app. when IE and Firefox have no problem?

Posted on 2008-10-30
18
1,321 Views
Last Modified: 2013-11-10
We have an HTML and Javascript site of statistical calculators that runs either from the web or directly from one's hard disk.  We use a cookie to save language and other preferences. This is fine either off-line or on-line in IE and Firefox, but the new Chrome browser will not save to the cookie when off line.  Is this deliberate, and is there a way around it in JavaScript?  The code is at www.openepi.com
0
Comment
Question by:Andy_in_Doral
  • 7
  • 6
  • 2
  • +1
18 Comments
 

Expert Comment

by:agdean9
ID: 22859679
Perhaps my spelling of "cookie" as "cooke" is the problem.  
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 22860274
Is in the offline version the Google analytics script at bottm of code.html included?

0
 

Expert Comment

by:agdean9
ID: 22860419
Thank you, Zvonko, for this suggestion, as I have had trouble with script being between the </body> tag and the </html>  tag before.  However the cookie problem is easily demonstrated by code from a tutorial on cookies.  Save the following demo to a disk file and then run it both from the net and from the disk copy with IE or Firefox and then with Google Chrome.

http://elated.com/res/File/articles/development/javascript/javascript-and-cookies/cookies_page.html

The demo page accepts a name and stores it in a cookie when run from a website, or from disk in IE or Firefox.  Chrome runs it correctly from the website, but when running the HTML from disk, fails to save the name in a cookie.  It asks repeatedly for your name because it can't save the answer to a cookie.  

This simple example should help to clarify the problem, and exclude the complexities..
0
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 100 total points
ID: 22860529
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 22863543
Use this cookie control parameter: -enable-file-cookies
Like this:
C:\Users\Zvonko\AppData\Local\Google\Chrome\Application\chrome.exe --enable-file-cookies

The reason why you need that parameter is described here:
http://code.google.com/p/chromium/issues/detail?id=535


0
 

Accepted Solution

by:
agdean9 earned 150 total points
ID: 22867021
Thank you Zvonko.  This is exactly the issue, and the documentation I need.  Now that I know not saving cookies in off-line mode was a decision of the Chromium team, how can I allow users to run our statistical calculators off-line in Chromium?  The way I see it, the choices are:
   1)  Ask them to learn how to run Chrome from the command line.
   2) Somehow give them a desktop shortcut that does so, only for Chrome and only in Windows
   3) Tell them not to use Chrome to run OpenEpi from disk.
   4) Detect Chrome in Javascript and pop a message about having no language or statistical settings
   5) Convince the Chromium team that whatever works in FF and IE should also work in Chrome, and not just fail mysteriously without further information.  

Any suggestions for a workaround?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22867122
Why not do 4 + 1 ?

tell them that the current BETA (more like Alpha) version of Chromium needs a shortcut to allow offline cookies
I am sure the users of that browser are more than average technical...
0
 

Expert Comment

by:agdean9
ID: 22873222
Could do this, at least in Windows, if life and limb depended on it, but it seems extreme in order to get Chrome to do what FF and IE do smoothly.

I'm no wizard on the details of security, but it seems like allowing a page from any website to save a cookie as long as the page is on-line is more dangerous than allowing a page that has been downloaded and saved to save a cookie in the absence of an Internet connection.  Perhaps the Chromium team will change their minds, as I'm sure there are lots of on-line/off-line internet applications that depend on cookies for settings.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22874579
If I can get you to save MY page, I can in MY page read all cookies from all offline pages you have saved and which have saved cookies while offline and send them to MY server quite easily.

That is the reason
0
 

Expert Comment

by:agdean9
ID: 22877204
IIt sounds like MY is spyware. In the current version of Chrome, runninng on-line, MY can read and write cookies, sending them wherever it wants.  How is this prevented by keeping it from reading and writing cookies when there is no Internet connection?   Even if you prevent IE and FF from writing cookies off-line, there will always be cookies to read, whether written off-line or on-line.

I hope the Chromium team will come up with a way to do what is safe without requiring  browser specific workarounds just to store the user's language preference.  Google has gone to great effort to enable offline applications (e.g., with Gears), and this seems to block that effort.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22877238
I wrote "if MY page" as in "if the page you save on your harddisk" and I am of course talking about spyware
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22877260
0
 

Expert Comment

by:agdean9
ID: 22888604
Thank you for the HTML5 draft document.  I'm afraid I must leave this to wiser heads than mine, but I think I have made my desires clear.  All I want is for the Chrome browser to let HTML/Javascript pages that are run from the local disk,  read and write their own cookies in order to save settings.  

Thanks to all for clarifying the issues.
0
 

Expert Comment

by:agdean9
ID: 23012598
Please close this thread.  I hope the Google Chrome crew will fix the problem and allow offline apps to read and write their own cookies.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 23019568
You can close it by accepting your own comment as solution
0
 

Author Comment

by:Andy_in_Doral
ID: 23707190
It appears that new Chrome updates have fixed the problem.   Yeah!!!

0
 

Author Closing Comment

by:Andy_in_Doral
ID: 31511928
Thanks, everybody, and to the Passage of Time, and especially to the Chrome Team for fixing the problem.  
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Several part series to implement Internet Explorer 11 Enterprise Mode
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now