How to get rid of the Safari 5 reader

Safari 5 reader displays the pages of a site without advertising, apparently a way for Apple to go after Google, the Adsense service of which monetizing the majority of websites.

This contradicts the rules of a site when conditions prohibit the modification of pages before their display by any external tool.

That leaves webmasters to find a way to undo this tool to maintain their advertising revenues.

Apple has not made the tool itself, it only integrated an open source software, Readability. The source code is here.
Actually the Readability team has initially praised Apple for its product before realizing that it had used its own code.

We can see that we are facing geniuses!

Test pages

To verify the effectiveness of measures that might be used by a webmaster to counteract this reader, here is a list of pages on this site on which the reader button does not appear in the Safari browser.
This will allow to check over time if it is always the case with future versions of Safari.

Now, here are the measures to defeat their algorithm.

How to eliminate the reader

From the test pages, we will attempt to draw lessons. However, it is not easy to see why the reader button appears or not.
Actually there are cases where it always appears. A page with a simple block of text always let the reader to appear. When adding tables, images, lists, it becomes less obvious.

The fragmentation of a text is what appears to counteract the script in Safari: it has difficulty in this case to form a page containing a simple text which is another of its goals besides to annoy Google and all its affiliates.

On this page, I included the following paragraph into a <div> and it suffices to disable the reader.

Using JavaScript

The following code identifies the Safari browser:

var agent = navigator.userAgent;
var isSafari = agent.indexOf("Safari") > -1 && agent.indexOf("Chrome") == -1;

The page is reloaded with this command:


However, the reader constructs a page in Safari from the rendering produced by the browser after JavaScript has been executed, so we can not test the status of the page with JavaScript.
We will instead use JavaScript to prevent readability to work with function activated only by Safari that is recognized as explained above.

Example of code:

<script type="text/javascript">
var agent = navigator.userAgent;
var isSafari = agent.indexOf("Safari") > -1 && agent.indexOf("Chrome") == -1;
function reloading() { window.location.reload(); }
if(isSafari) {
setTimeout(reloading, 6000);

This code reloads the page after six seconds when you pass under the reader and it displays the original full page.

But it hinders the use of the URL bar. And it should not be used with pages displaying ads paid by the number of displays.
To be used only if the number or Safari users is very important.

If tools such as the Safari reader proliferate, we should also see spreading dynamic pages depending JavaScript code rather than pages of plain text easily interpreted by these tools.