Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Using Cookies with Local files

Reply
Thread Tools

Using Cookies with Local files

 
 
mfhiatt@netins.net
Guest
Posts: n/a
 
      06-15-2006
I'm using a cookie on a site that works fine.

BUT

When I run the files from my local hard drive, it doesn't work.

Can you use cookies with files that reside locally? If not, is there a
solution that would work with both local files and files that reside on
a server?

Thanks

Mike

please respond to:

http://www.velocityreviews.com/forums/(E-Mail Removed)

 
Reply With Quote
 
 
 
 
Leonard Blaisdell
Guest
Posts: n/a
 
      06-16-2006
In article <(E-Mail Removed) .com>,
"(E-Mail Removed)" <(E-Mail Removed)> wrote:

> Can you use cookies with files that reside locally? If not, is there a
> solution that would work with both local files and files that reside on
> a server?


You need to be running a server on your machine. It's not particularly
difficult.

> please respond to:
> (E-Mail Removed)


Not today

leo

--
<http://web0.greatbasin.net/~leo/>
 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      06-16-2006

(E-Mail Removed) wrote:
> I'm using a cookie on a site that works fine.
>
> When I run the files from my local hard drive, it doesn't work.


Cookies are a HTTP thing, not a HTML thing. You need a HTTP server, not
just a local filesystem.

Best way for a HTTP server is to find a tired old PC and resurrect it
running a minimal Unix and Apache. Try Ubuntu, or the ready-packaged
"minimal Unix and Apache" bundles. You'll not regret this as a web
developer, it makes deployment out to the live servers much less
troublesome. Many things are now getting more and more sensitive to
HTTP content-type etc. and although filesystems work for the basics,
they're never exactly the same environment.

If you're on a laptop and mobile, then you're probably running Windows
and you can still run a web server on there. IIS / PWS for Windows
native, or even Apache again.

 
Reply With Quote
 
Alan J. Flavell
Guest
Posts: n/a
 
      06-16-2006
On Fri, 16 Jun 2006, Andy Dingley <(E-Mail Removed)> wrote:

> You need a HTTP server, not just a local filesystem.


There are indeed many advantages in running a local web server on
one's development platform.

> Best way for a HTTP server is to find a tired old PC and resurrect
> it running a minimal Unix and Apache.


I would dare to suggest that the best way is to run Apache on whatever
one's development platform happens to be.

If it's OS X, like on my colleague's laptop, then that's where Apache
gets run.

In the event that one was running MS Win (XP, 2K etc.) then Win Apache
2.0 is a viable solution (whereas Win Apache 1.3 had less to recommend
it). There are some significant differences on the Win platform, but
if one steers clear of them (case sensitivity in URLs, differences in
XBitHack behaviour...) then whatever is developed on the Win platform
can port rather seamlessly to the real server.

> Try Ubuntu, or the ready-packaged "minimal Unix and Apache" bundles.


I'm *not* recommending specifically choosing MS Win for this purpose,
but *if* one is using MS Win already, then that's where I would
recommend running the development server. You probably want to set it
so that it only accepts calls from localhost (or from a very tightly
controlled range of addresses).

> You'll not regret this as a web developer, it makes deployment out
> to the live servers much less troublesome.


Absolutely.

> If you're on a laptop and mobile, then you're probably running
> Windows and you can still run a web server on there. IIS / PWS for
> Windows native, or even Apache again.


If the ultimate production server is going to be Apache-family, then I
can't see the slightest attraction in running IIS. It would need a
different skillset, quite apart from imponderables in the security
area.

hth
 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      06-16-2006
Alan J. Flavell wrote:
> On Fri, 16 Jun 2006, Andy Dingley <(E-Mail Removed)> wrote:
>
> > You need a HTTP server, not just a local filesystem.

>
> There are indeed many advantages in running a local web server on
> one's development platform.


No-one ever got sacked for learninmg Unix.

Old Apache under Windows was certainly an evil thing. I'm glad to have
it confirmed that later ones are better -- I've not much experience of
it myself.

 
Reply With Quote
 
mfhiatt@netins.net
Guest
Posts: n/a
 
      06-16-2006

But if I send out a site on a CD, what can I use in lieu of cookies for
the end user? Flash Shared Obects? Anything else?

Andy Dingley <(E-Mail Removed)> wrote:
> Alan J. Flavell wrote:
> > On Fri, 16 Jun 2006, Andy Dingley <(E-Mail Removed)> wrote:
> >
> > > You need a HTTP server, not just a local filesystem.

> >
> > There are indeed many advantages in running a local web server on
> > one's development platform.

>
> No-one ever got sacked for learninmg Unix.
>
> Old Apache under Windows was certainly an evil thing. I'm glad to have
> it confirmed that later ones are better -- I've not much experience of
> it myself.


 
Reply With Quote
 
=?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=
Guest
Posts: n/a
 
      06-19-2006
(E-Mail Removed) wrote:

> I'm using a cookie on a site that works fine.
>
> BUT
>
> When I run the files from my local hard drive, it doesn't work.
>
> Can you use cookies with files that reside locally? If not, is there a
> solution that would work with both local files and files that reside
> on a server?


Nothing that's 100% foolproof, though. The closest thing you get, is by
using the JavaScript property document.cookie.
http://www.w3schools.com/js/js_cookies.asp

Keep in mind that this method won't work if you have JavaScript (or
client-side scripting in general) disabled or unavailable in your
browser.

> Thanks
>
> Mike


No problem.

> please respond to:
>
> (E-Mail Removed)


You ask a question on Usenet, we respond to you on Usenet.

--
Kim André Akerĝ
- (E-Mail Removed)
(remove NOSPAM to contact me directly)
 
Reply With Quote
 
Steven Saunderson
Guest
Posts: n/a
 
      06-19-2006
On 15 Jun 2006 11:04:29 -0700, "(E-Mail Removed)" <(E-Mail Removed)>
wrote:

> Can you use cookies with files that reside locally? If not, is there a
> solution that would work with both local files and files that reside on
> a server?


It's possible if you have Javascript enabled. I have some pages that
use a cookie to remember which checkboxes are selected.

Is this the sort of capability you require ?

--
Steven
 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      06-19-2006

(E-Mail Removed) wrote:
> But if I send out a site on a CD, what can I use in lieu of cookies for
> the end user? Flash Shared Obects? Anything else?


Don't use cookies.

I can't think of many reasons why you'd really need them, for a
competently authored site, delivered on CD. There are a _few_ reasons,
generally based on making persistent user choices or recording state.
Most of the "traditional" cookie reasons though only make sense with a
server-based process, or they're somewhat dubious anyway (such as
storing font size choices in a cookie).

 
Reply With Quote
 
Nick Theodorakis
Guest
Posts: n/a
 
      06-20-2006
(E-Mail Removed) wrote:
> But if I send out a site on a CD, what can I use in lieu of cookies for
> the end user? Flash Shared Obects? Anything else?


I'm at a bit of a loss as to why a local website needs to set cookies.
Can you elaborate?

Nick



--
Nick Theodorakis
(E-Mail Removed)
contact form:
http://theodorakis.net/contact.html
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Give Request.Cookies and Response.Cookies is there any reason to use another method to use cookies? _Who ASP .Net 7 09-18-2008 07:49 PM
What's the proper way of reading cookies? Request.Cookies("mycook") doesnt work user ASP .Net 3 03-31-2007 01:53 PM
Response.Cookies vs Request.Cookies Alex Nitulescu ASP .Net 1 02-03-2005 09:43 AM
Persistent Cookies vs. session cookies Andy Fish Java 3 11-06-2003 10:44 AM
Good Cookies bad Cookies? AK Computer Support 23 10-26-2003 05:20 AM



Advertisments