Solved

Cookie usage for web pages on my hard disk

Posted on 2013-01-31
9
175 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:ttitus
9 Comments
 
LVL 52

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:ttitus
ID: 38841616
I don't have a webserver on my laptop, thus no localhost.
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 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
 
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:ttitus
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:ttitus
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:ttitus
ID: 38842127
Sadly, it didn't work.  Google should list that option as deprecated due to security issues.
0
 

Author Closing Comment

by:ttitus
ID: 38842129
Good discussion.
0
 
LVL 82

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
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 …

747 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

12 Experts available now in Live!

Get 1:1 Help Now