How to disable Safari Reader in a web page
Posted
by michael
on Stack Overflow
See other posts from Stack Overflow
or by michael
Published on 2010-06-08T17:12:23Z
Indexed on
2010/06/09
8:52 UTC
Read the original article
Hit count: 419
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:
- You need at least one H tag
- It does not go by character count alone but by the number of P tags and length
- Probably looks for sentence breaks '.' and other criteria
Safari will provide the 'Reader' if, with a H tag, and the following:
- 1 P tag, 2417 chars
- 4 P tags, 1527 chars
- 5 P tags, 1150 chars
- 6 P tags, 862 chars
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:
- Setting
<p style="display:none;">
for P tags removes them from the count - Setting
display
tonone
, and then showing them 230ms later with Javascript avoided the Reader option too
I'd be interested if anyone can determine this in full.
© Stack Overflow or respective owner