Using Cookies with Local files

Discussion in 'HTML' started by mfhiatt@netins.net, Jun 15, 2006.

  1. Guest

    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:

    , Jun 15, 2006
    #1
    1. Advertising

  2. In article <>,
    "" <> 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:
    >


    Not today :-(

    leo

    --
    <http://web0.greatbasin.net/~leo/>
    Leonard Blaisdell, Jun 16, 2006
    #2
    1. Advertising

  3. Andy Dingley Guest

    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.
    Andy Dingley, Jun 16, 2006
    #3
  4. On Fri, 16 Jun 2006, Andy Dingley <> 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
    Alan J. Flavell, Jun 16, 2006
    #4
  5. Andy Dingley Guest

    Alan J. Flavell wrote:
    > On Fri, 16 Jun 2006, Andy Dingley <> 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.
    Andy Dingley, Jun 16, 2006
    #5
  6. Guest

    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 <> wrote:
    > Alan J. Flavell wrote:
    > > On Fri, 16 Jun 2006, Andy Dingley <> 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.
    , Jun 16, 2006
    #6
  7. 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:
    >
    >


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

    --
    Kim André Akerø
    -
    (remove NOSPAM to contact me directly)
    =?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=, Jun 19, 2006
    #7
  8. On 15 Jun 2006 11:04:29 -0700, "" <>
    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
    Steven Saunderson, Jun 19, 2006
    #8
  9. Andy Dingley Guest

    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).
    Andy Dingley, Jun 19, 2006
    #9
  10. 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

    contact form:
    http://theodorakis.net/contact.html
    Nick Theodorakis, Jun 20, 2006
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Nitulescu

    Response.Cookies vs Request.Cookies

    Alex Nitulescu, Feb 3, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    8,454
    Hans Kesting
    Feb 3, 2005
  2. Andy Fish
    Replies:
    3
    Views:
    6,504
    Fredrik Lindner
    Nov 6, 2003
  3. user
    Replies:
    3
    Views:
    647
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    Mar 31, 2007
  4. archana
    Replies:
    1
    Views:
    499
  5. _Who
    Replies:
    7
    Views:
    2,630
Loading...

Share This Page