I'm curious to know more about what triggers the Reader option in Safari and what does not. I wouldn't plan to implement anything that would disable it, but curious as a technical exercise.
Here is what I've learned so far with some basic playing around:
Safari will provide the 'Reader' if, with a H tag, and the following:
If you subtract 1 character from any of the above, the 'Reader' option is not available.
I should note that the character count of the H tag plays a part but sadly did not realize this when I determined the results above. Assume 20+ characters for H tag and fixed throughout the results above.
Some other interesting things:
<p style="display:none;">
for P tags removes them from the countdisplay
to none
, and then showing them 230ms later with Javascript avoided the Reader option tooI'd be interested if anyone can determine this in full.
There is currently no legit way of disabling Reader View for your website. Reader View is supposed to automatically detect on what pages it should be available and on what pages it should not.
Tap at the left end of the address field, then tap Show Reader View. To return to the full page, tap , then tap Hide Reader View. Note: If Show Reader View is dimmed in the window, Reader view isn't available for that page.
The Reader mode, built into Apple's Safari browser since 2010 and available on macOS and iOS, strips away web advertisements and the page's navigational design to present an article's text and basic images in a clean and uncluttered format.
Tap the Reader View icon in the top left of Safari. Select Website Settings from the dropdown menu. Turn on the toggle for Use Reader Automatically and press Done. The webpage will now automatically switch to Reader View every time you open it.
Adding markup to potentially "readable" tags, like p
and div
, can cause the Readability algorithm to ignore the tag, thus lowering the score, hopefully to a point that it doesn't trigger the Reader icon to display.
Looking at the Readability source, one area to do this is in the id
and class
attributes, as it does pattern matching on the combined data from these two attributes. For example, adding a "comment" class, like so
<p class="myClass comment">...</p>
will cause that element to be ignored. The pattern that is being matched for "unlikely" candidates is:
/combx|comment|disqus|foot|header|menu|rss|shoutbox|sidebar|sponsor/i
Placing flags on the elements that might add to the Readability Score can allow you to disable the Reader icon.
“You need at least one <h*>
element” — this is simply incorrect. Here’s an example: http://mathiasbynens.be/demo/safari-reader-test-3
My answer on the other Safari Reader question provides some more info.
You could also read my blog post on enabling Safari Reader for all my findings on the subject.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With