April 19, 2025

Textual description of firstImageUrl

How to use JavaScript bookmarklet to bypass paywalls

|

Use JavaScript bookmarklet to remove paywalled articles.

Find out how to use JavaScript bookmarklet to bypass paywalls, so you can access blocked websites without subscription.

A bookmarklet is a browser bookmark, also known as bookmark applet, favlet, or JavaScript bookmark.

It is a link that contains JavaScript, and it executes JavaScript on the page, instead of opening a webpage. 

JavaScript bookmarklets have many uses that include: to modify web content, to remove elements from the page, to show the hidden accessibility features on web pages, etc.

But for this post, I am going to show you how to create a simple JavaScript bookmarklet to circumvent website paywalls.

These three JavaScript do not disable JavaScript.

Instead they use JavaScript to get past the digital barriers.

This is another post from The DiGiztal Bypass Paywalls Tips series.

How to use JavaScript bookmarklet to bypass paywalls

Now let's find out how it is done.

How to create JavaScript bookmarklet to bypass paywalls

Here are three versions of JavaScript bookmarklets that can get past paywalls.

The first two bookmarklets is just with one click and it goes straight to the website.

The third type is it goes to the Google search results page, where you get the free article.

First Version: Directly unblock the articles 

For example, if you want to access the The New Yorker paywalled articles.

Google Chrome browser:

Press Ctrl + Shift + O keys to bring up the Bookmark manager page called Bookmarks.

Click the three dots on top of the right hand corner.

A menu pops up, click “Add new bookmark”.

JavaScript Bookmarklet Paywall Bypass

The "Add bookmark" box appears.

For the Name, you can call it Bypass The New Yorker Paywall.

Paste the following set of code inside the URL space:

javascript:(function() {
    if (window.location.host.match(/newyorker.com$/)) {
        /* Flush all cookies. */
        var cookies, subdomain, pathname;
        cookies = document.cookie.split(';');
        for (var i = 0; i < cookies.length; i++) {
            subdomain = '.' + window.location.host;
            while (subdomain) {
                pathname = window.location.pathname;
                while (pathname) {
                    document.cookie=(
                       cookies[i] +
                       '; domain=' + subdomain +
                       '; path=' + pathname +
                       '; expires=Thu, 01 Jan 1970 00:00:01 GMT;');
                    pathname = pathname.replace(/.$/, '')
                }
                subdomain = subdomain.replace(/^(?:\.|[^\.]+)/, '');
            }
        }
        /* Flush local storage. */
        try {
            localStorage.clear();
        } catch (e) { }
        /* Flush backup of the metering cookie. */
        window.name = null;
        /* Reload current page stripping the query string. */
        window.location = window.location.href.split('?')[0];
    } else {
        alert('This bookmarklet is to bypass the newyorker.com only.');
    }
})();

Then click the "Save" button.

Now the JavaScript bookmarklet in the Chrome toolbar or bookmark.

When you encounter any of The New Yorker article behind its paywall, just click the bookmarklet. 

Mozilla Firefox:

To install bookmarklet on Firefox browser, this is what you do:

Press Ctrl + B keys, and the list of your bookmarks appears on the left hand side of the page.

Right click "Bookmarks Toolbar", .a menu pops up, click "Add Bookmark...".

JavaScript Bookmarklet Mozilla Firefox

The "Add bookmark" box pops up.

The Name space, you can call it Access The New Yorker Free.

The URL box, paste the same above line of code inside it.

Leave the Tags and Keyword boxes blank.

Finally click the "Save" button.

NOTE: The above bookmarklet can only get past The New Yorker digital barrier.

This method can can get through a number of paywalled websites, but you have to change the domain newyorker.com in the code.

How does this code work: The script's main goal is to make your browser forget everything it knows about your past visits to NewYorker.com. 

By doing this, it tricks the website into treating you as a brand-new visitor, letting you see content without the paywall.

It achieves this through several steps:

Safety Check: First, it makes sure you're actually on NewYorker.com. If not, it won't run and will show an alert.

Delete Cookies: It forcefully deletes all cookies that The New Yorker has saved in your browser. 

These cookies are what the website uses to track how many articles you've read and other paywall-related info. It's very thorough, clearing cookies from all parts of the New Yorker site.

Clear Local Storage: Modern websites also store data in "Local Storage" (another place in your browser). The script wipes out all data stored there by The New Yorker, which might also contain paywall tracking.

Clear Window Name: Some sites use a less common trick, storing data in something called window.name. This script clears that too, just in case it's used as a backup for tracking.Reload Page: Finally, after clearing all this tracking data, the script reloads the current page. 

Because all the old tracking info is gone, the New Yorker website now thinks you're a first-time visitor and lets you read the content.


Second Version: Click and complete article appears 

Save this set of code to toolbar or bookmark.

The procedure is the same, as explained above . 

javascript:(function(){fetch(location.href).then((e=>e.text())).then((e=>{const t=document.createElement("iframe"),n=document.createElement("div");for(n.innerText="",n.style.cssText="border: none; margin: 0px; padding: 0px; text-align: center; color: white; font-size: 1.5rem; height: 2rem; background: black;",t.style.cssText="width: 100%; height: 100vh; border: none; margin: 0px; padding: 0px; padding-bottom: 2rem;",t.sandbox="";document.body.firstChild;)document.body.firstChild.remove();document.body.append(n,t),document.body.style.cssText=document.documentElement.style.cssText="overflow: hidden; border: none; margin: 0px; padding: 0px;",t.srcdoc=e}));}())

Like the first version, save the code to your toolbar or bookmark.

To read the paywalled webpage, click the bookmarklet.

How does it work: This JavaScript tricks websites that hide their full articles behind a blurry screen or popup. 

It simply grabs that hidden article and shows it to you in a clean window, ignoring the stuff that was hiding it.


Third Version: Free articles from Google search results page

The procedure of setting up the bookmarklet is the same as the Version One.

But this is the line of code that you need to bookmark on your browser:

javascript:window.location='https://google.com/search?q='+window.location.href;

How to use this JavaScript bookmarklet bypass paywalls

For instant you come across this New York Times paywalled article, "Can Harvard Withstand Trump’s Financial Attack?"

JavaScript Bookmarklet Bypass Paywall

Click the JavaScript bookmarklet.

Instantly the Google search results page with that particular article should appear at the top of the list.

Bypass NYTimes Paywall JavaScript Bookmarklet

Click the article, and this time it should appear in full, without the subscription banner below the page.

Read New York Times Without Paywall

The method is each time you come to The NYTimes blocked article, click this JavaScript bookmarklet.

 If after using it for a while, and it stops bypassing the paywall, then you have to clear the browsing history of your browser. 

So these are the two types of JavaScript bookmarklets to remove paywalls.

How does it work: With this code, the websites let Google's robots see their full content without paywalls, so it appears in search results. 

When you search for an article's link on Google, it has already accessed and saved that content.

Google often keeps a cached copy of web pages.

So when you click the link, you get it from this saved or cached version, which was taken before the paywall appeared or when Google's robots were allowed in.

These are ways how to get through paywalls with JavaScript bookmarklet.

NOTE: These methods may not involve direct hacking or unauthorized access, they can still violate anti-circumvention laws and terms of service. Consider using the legal and ethical ways to access paywalled web articles.


RELATED TIPS:





DISCLAIMER: This post is for educational purposes only. It aims to help you better understand web technologies and digital security. It does not endorse breaking website rules or illegal activity. Use responsibly; the author is not liable for misuse or legal issues.