Created
February 27, 2021 15:16
-
-
Save GokulNC/531c8595dd77fb46e112f99ce6df4021 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* For my usage with the "Custom JavaScript for Websites 2" extension, | |
to jump across trial-based paywalls of certain websites like nautil.us or medium.com */ | |
// Delete all cookies (Src: https://stackoverflow.com/a/33366171 ) | |
(function () { | |
var cookies = document.cookie.split("; "); | |
for (var c = 0; c < cookies.length; c++) { | |
var d = window.location.hostname.split("."); | |
while (d.length > 0) { | |
var cookieBase = encodeURIComponent(cookies[c].split(";")[0].split("=")[0]) + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=' + d.join('.') + ' ;path='; | |
var p = location.pathname.split('/'); | |
document.cookie = cookieBase + '/'; | |
while (p.length > 0) { | |
document.cookie = cookieBase + p.join('/'); | |
p.pop(); | |
}; | |
d.shift(); | |
} | |
} | |
})(); | |
// Delete other storages | |
localStorage.clear(); | |
sessionStorage.clear(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment