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. Advertising

  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. Advertising

  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. 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. Simon-Pierre  Jarry
    Replies:
    2
    Views:
    2,387
    Henrik
    Aug 10, 2005
  2. ken
    Replies:
    1
    Views:
    276
    John J. Lee
    Apr 1, 2007
  3. Replies:
    2
    Views:
    479
  4. Paul  Wolpe
    Replies:
    0
    Views:
    169
    Paul Wolpe
    Oct 17, 2005
  5. Vikram Bhatia
    Replies:
    1
    Views:
    247
    kaeli
    Oct 11, 2003
Loading...

Share This Page