Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Cookie usage for web pages on my hard disk

Posted on 2013-01-31
9
Medium Priority
?
184 Views
Last Modified: 2013-01-31
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?
0
Comment
Question by:Tim Titus
9 Comments
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 38841571
It should work if you use localhost rather then just opening it in the browser from your file system.
0
 

Author Comment

by:Tim Titus
ID: 38841616
I don't have a webserver on my laptop, thus no localhost.
0
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 38841677
Then cookies will not work properly because they have no 'domain' that they are served from.  There are no settings that will change that.  Except installing a web server.  If they are all just HTML pages, the requirements are minimal.  What OS on your laptop?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Expert Comment

by:Paul Jackson
ID: 38841689
The use of cookies is only possible when web pages are served by a web server.
0
 

Author Comment

by:Tim Titus
ID: 38841693
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.
0
 

Author Comment

by:Tim Titus
ID: 38841699
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.
0
 

Author Comment

by:Tim Titus
ID: 38842127
Sadly, it didn't work.  Google should list that option as deprecated due to security issues.
0
 

Author Closing Comment

by:Tim Titus
ID: 38842129
Good discussion.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38842147
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.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Suggested Courses

783 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