Link to home
Start Free TrialLog in
Avatar of Tim Titus
Tim TitusFlag for United States of America

asked on

Cookie usage for web pages on my hard disk

I have some HTML pages that are stored locally on my laptop's hard disk.  These pages are for product demonstration purposes, so there's no need for a webserver.

These web pages work correctly when hosted on a webserver with regards to saving cookies for pages.

When I view the pages from my local hard disk (no webserver), cookies are not stored or read in.  As a result, the pages do not have the same interaction as they would when hosted.

Is there some setting in IE or Chrome that would permit saving & reading cookies for locally stored web pages?
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

It should work if you use localhost rather then just opening it in the browser from your file system.
Avatar of Tim Titus

ASKER

I don't have a webserver on my laptop, thus no localhost.
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The use of cookies is only possible when web pages are served by a web server.
I have Win7 on my laptop.

I'm currently reading that there is a command-line option in Chrome that might solve the problem of saving cookies for local pages, but I haven't played with that yet.

I would like to use either Chrome (preference), or IE for my demonstrations, so if you know of a method that would work for either browser, that would fix my problem.

If there is no elegant fix, then I'll take 2 days and code a really lightweight webserver that will only support pages requested from localhost so it will work/act more like it should.
Here's the Chrome switch:

By default, cookies are not allowed on file://. They are needed in for
testing, for example page cycler and layout tests. See bug 1157243.
--enable-file-cookies

This was from http://www.ericdlarson.com/misc/chrome_command_line_flags.html

I haven't tested yet, but am about to try.
Sadly, it didn't work.  Google should list that option as deprecated due to security issues.
Good discussion.
Thanks for the points.  As far as I can tell, almost nothing ever gets deleted on the internet.  You are always stuck with making sure that anything you find is still current.