How to remove a cookie by using Javascript?

Discussion in 'Javascript' started by Phper, Nov 26, 2009.

  1. Phper

    Phper Guest

    How to remove the cookie set by
    javascript:void
    (document.cookie=”PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602:LM=1257919388:S=odm0Ys-53ZueXfZG;path=/;
    domain=.google.com”);

    The following statement doesn't work.
    javascript:void
    (document.cookie=”PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602:LM=1257919388:S=odm0Ys-53ZueXfZG;expires=Thu,
    01 Jan 1970 00:00:00 GMT;path=/; domain=.google.com”);
    What's wrong with the code?
     
    Phper, Nov 26, 2009
    #1
    1. Advertisements

  2. Phper wrote:

    > How to remove the cookie set by
    > javascript:void
    > (document.cookie=â€PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602:LM=1257919388:S=odm0Ys-53ZueXfZG;path=/;
    > domain=.google.comâ€);
    >
    > The following statement doesn't work.
    > javascript:void
    > (document.cookie=â€PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602:LM=1257919388:S=odm0Ys-53ZueXfZG;expires=Thu,
    > 01 Jan 1970 00:00:00 GMT;path=/; domain=.google.comâ€);
    > What's wrong with the code?


    You cannot set cookies for other domains than the one your script runs on.
    So if your script does not run somewhere on .google.com, the browser
    ignores your request to set a cookie for that domain.

    Matt
     
    Matthias Reuter, Nov 27, 2009
    #2
    1. Advertisements

  3. Phper

    Zigurds Guest

    On Nov 26, 11:25 am, Phper <> wrote:
    > How to remove the cookie set by
    > javascript:void
    > (document.cookie=”PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602­:LM=1257919388:S=odm0Ys-53ZueXfZG;path=/;
    > domain=.google.com”);
    >
    > The following statement doesn't work.
    > javascript:void
    > (document.cookie=”PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602­:LM=1257919388:S=odm0Ys-53ZueXfZG;expires=Thu,
    > 01 Jan 1970 00:00:00 GMT;path=/; domain=.google.com”);
    > What's wrong with the code?
     
    Zigurds, Nov 30, 2009
    #3
  4. Phper

    Zigurds Guest

    On Nov 30, 10:57 pm, Zigurds <> wrote:
    > On Nov 26, 11:25 am, Phper <> wrote:
    >
    >
    >
    > > How to remove the cookie set by
    > > javascript:void
    > > (document.cookie=”PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602­­:LM=1257919388:S=odm0Ys-53ZueXfZG;path=/;
    > > domain=.google.com”);

    >
    > > The following statement doesn't work.
    > > javascript:void
    > > (document.cookie=”PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602­­:LM=1257919388:S=odm0Ys-53ZueXfZG;expires=Thu,
    > > 01 Jan 1970 00:00:00 GMT;path=/; domain=.google.com”);
    > > What's wrong with the code?- Hide quoted text -

    >
    > - Show quoted text -
     
    Zigurds, Dec 4, 2009
    #4
    1. Advertisements

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. Ben
    Replies:
    3
    Views:
    6,244
    Steven Cheng[MSFT]
    Jun 3, 2004
  2. Shapper

    Cookie and Session Cookie Questions.

    Shapper, Apr 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    784
  3. Simon-Pierre  Jarry
    Replies:
    2
    Views:
    2,626
    Henrik
    Aug 10, 2005
  4. =?Utf-8?B?UGF1bA==?=

    Cookie Question (IP as domain and cookie file location)

    =?Utf-8?B?UGF1bA==?=, Jan 10, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    2,749
    Bruce Barker
    Jan 10, 2006
  5. ken
    Replies:
    1
    Views:
    348
    John J. Lee
    Apr 1, 2007
  6. Replies:
    2
    Views:
    703
  7. Paul  Wolpe
    Replies:
    0
    Views:
    258
    Paul Wolpe
    Oct 17, 2005
  8. Vikram Bhatia
    Replies:
    1
    Views:
    338
    kaeli
    Oct 11, 2003
Loading...