SEO Software
Closed Thread
Results 1 to 3 of 3

Thread: Cookie erase using JS

  1. #1

    Default Cookie erase using JS

    Helllo All

    I am trying to erase cookies using javascript. Please help me to get javascript code for it.

    Thank you


  2. Micro Niche Builder

  3. #2
    Fresh Meat Zoli is on a distinguished road Zoli's Avatar
    Join Date
    Jan 2009
    Location
    Veszpr?m, Hungary
    Posts
    29
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default

    Hi,
    You may look for this code
    HTML Code:
    function delete_cookie ( cookie_name )
    {
      var cookie_date = new Date ( );  // current date & time
      cookie_date.setTime ( cookie_date.getTime() - 1 );
      document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
    }
    JavaScript and Cookies

    Otherwise if I were you I would rather go with php since it does not depend on the client's configuration
    PHP Code:
    setcookie('user','',time()-3600

  4. #3
    Mr. BindasS ankur0412 is on a distinguished road ankur0412's Avatar
    Join Date
    Feb 2009
    Location
    India
    Posts
    717
    Thanks
    24
    Thanked 54 Times in 42 Posts
    Blog Entries
    2

    Default

    you can try out this code...

    < script language="Javascript">
    function deletecook()
    {
    var d = new Date();
    document.cookie = "v0=1;expires=" + d.toGMTString() + ";" + ";";
    alert(document.cookie);
    }

    < /script>
    < /head>
    < body>
    < a href="javascript:deletecook();">delete cookie< /a>
    < /body>

Closed Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts