Question

I have searched to find a way that I can clear cookies from a browser for a specific site just by appending parameters to an end of a URL. I assume that if this even existed it would be browser dependent. Due to not finding anything within a 30 minute search, I assume that this doesn't exist for any browser. I hope that

It is an odd situation why I need this. I use BigCommerce, and I need to clear out everything from my cart. I spent yesterday afternoon trying to find a BigCommerce arguement that allowed for this. After talking with support, they don't have a clearCart function that other shopping cart platforms has. They only have a clear item function/parameter that you can append to the end of a URL.

If I could clear all the cookies created by my site by a user clicking on a link, it would clear the contents of the cart. I have tried to hack the clear item parameters, but never could find a way to clear all items.

The clear item URL is like this: mysite.com/cart.php?action=remove&item=52fa8fd1e398b

Was it helpful?

Solution

Speaking generally first, no - there is no part of specification or browser implementations that supports arbitrarily clearing all cookies from a particular domain through the use of http GET parameters. This would be a horrible security hole if it did exist in either specification or practice. If it was possible, I could maliciously redirect your browser to some known site and destroy information that you did not want destroyed.

Now to your particular situation ... I gather that what you want to do is not so much clear the cookies from your own browser in this particular site, but rather, you are trying to implement a "clear cart" button on your own BigCommerce site. Is that right? If so, cookies is probably not the path forward that you are seeking. I don't think BigCommerce exposes shopping cart functions through their api. But I would be interested to hear from the BigCommerce folks on that. Your best bet to add a "clear cart" function is to add javascript to the page that iterates all cart items and makes that http call you mentioned. If you do this, make sure to have some graceful fallback for the case where they change the uri. :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top