/    Sign up×
Community /Pin to ProfileBookmark

problem deleting cookie through onLoad

Hey hows it going,
I’ve been trying for about atleast an hour now to get this cookie to delete.. I’ve tried several different methods, I’m not sure why it’s not working. Here’s the javascript code im using:

var today = new Date();
var expired = new Date(today.getTime() – 28 * 24 * 60 * 60 * 1000); // less 28 days
var dootie = document.cookie;

function deleteCookie(name){
document.cookie=name + “=null; expires=” + expired.toGMTString();
dootie = document.cookie;
alert(“cookie deleted.”);
}

when the page loads, this is in the body tag: onLoad=”deleteCookie(‘id’)”

Thanks for any ideas, I could really use them..

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@brokeDUstudentauthorSep 06.2003 — Here's the new code..

function deleteCookie(name){

var today = new Date();

today.setTime (today.getTime() - 28 * 24 * 60 * 60 * 1000); // less 28 days

var dootie = document.cookie;

var path = "/v2/";

var domain = ".bnosdesign.com";

var secure = "0";

document.cookie=name + "=null; expires=" + today.toGMTString() + "; path=" + path + "; domain=" + domain;

dootie = document.cookie;

alert("cookie deleted.");

}

and I call this in the body tag onLoad="deleteCookie('id')"

thanks anyway for looking, have a good one
×

Success!

Help @brokeDUstudent spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...