greatsoccerman1
greatsoccerman1

Reputation: 31

Deleting cookies from websites javascript

So I have looked around and it seems like everything is deleting cookies using Javascript but AFTER they CREATED it. My question is how do I delete a cookie from a website stored on my computer using javascript.

Say I go to www.yahoo.com and I get a cookie named "apeaf" (real cookie from yahoo) path = / accessible to script = yes

So my question is how would I write a JS script to delete that cookie? I did not make it I just want to write a script that basically says

document.cookie = 'Name=apeaf ; Path=/; Domain=.www.yahoo.com; Expires=Thu,01 Jan 1970 00:00:01 GMT;';

but that is not deleting it.

Upvotes: 0

Views: 72

Answers (1)

Blue
Blue

Reputation: 22911

You cannot delete or read cookies from other websites via javascript (Unless you're doing it from a developer extension or through the console). If you're looking to do this in a development environment, I suggest using the Developer tools that are available in most modern browsers:

Upvotes: 2

Related Questions