Ignore nytimes paywall with simple client-side javascript, or applescript
Alec Jacobson
April 21, 2011
Today was my first experience with the New York Times paywall. It manifested as an html overlay on top of the article I wanted to read. The article seemed to have fully loaded which made me think that if I could just get rid of the overlay I'd be able to read it.
This turned out to be the exactly case. I just zapped the div containing the overly (properly labeled id='overlay'
and restored the overflow of the main page (to get scrolling back).
This is easily accomplished with three lines of client side javascript:
document.getElementById('overlay').parentNode.innerHTML = '';
document.body.style['overflow-x'] = 'auto';
document.body.style['overflow-y'] = 'auto';
There are many ways of issuing your own javascript on pages opened in your browser, whatever that might be.
For me on a mac with safari, wrapping the above into a little applescript is easiest. I save this in a file called Ignore-nytimes-paywall.scpt
:
tell application "Safari"
try
set doc to front document
do JavaScript "document.getElementById('overlay').parentNode.innerHTML = '';" in doc
do JavaScript "document.body.style['overflow-x'] = 'auto';" in doc
do JavaScript "document.body.style['overflow-y'] = 'auto';" in doc
on error errText number errNum
end try
end tell
It seems that coming up with your own hack for knocking down the nytimes paywall is the trend these days. We're all blowing our technological Joshua trumpets ;-).
Update: I'm now more convinced that nytimes is just using this paywall as an experiment. Ignoring the paywall is even easier than I thought:
Readers need only remove “?gwh=numbers” from the URL. They can also clear their browser caches, or switch browsers as soon as they see the subscription prompt. All three of these simple fixes will let them continue reading.
Source
Update:
Seems the paywall organization has changed a little bit and now the client side javascript should be:
document.getElementById('regiwallBackground').style.display = 'none';
document.getElementById('regiwallOverlay').style.display = 'none';
document.body.parentElement.style.overflow = 'scroll';