阅读器视图如何操作

阅读器视图如何操作

本文介绍了Firefox 阅读器视图如何操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

总结

我正在寻找创建网页的标准,并[相当]确定它会出现在 Firefox 阅读器中查看,如果用户需要.

有些网站有这个选项,有些没有.一些文本较多的没有这个选项,而另一些文本则少得多.堆栈溢出实例仅显示问题而不是阅读器中的任何答案查看.

问题

我已将 Firefox 从 38.0.1 升级到 38.0.5,并发现了一项名为 ReaderView 的新功能 - 这是一种消除页面混乱"并使文本更易于阅读的叠加层.Readerview 位于地址栏的右侧,是某些页面上的可点击图标.

这很好,但从编程的角度来看,我想知道读者视图"是如何工作的,它适用于哪些页面的哪些标准.我已经对 Mozilla Firefox 网站进行了一些探索,但没有明确的答案(我发现的所有编程答案都是如此),我当然已经用谷歌搜索/对此进行了搜索,这仅返回了对 Firefox 插件的引用 - 这不是插件但它是新 Firefox 版本的主要部分.

我假设 readerview 使用 HTML5 并且会提取 内容,但事实并非如此,因为它适用于似乎没有使用 的维基百科. 或类似的 HTML5 标签,而不是 readview 提取某些

并单独显示它们.此功能适用于某些 HTML5 页面(例如维基百科),但不适用于其他页面.

如果有人对 Firefox ReaderView 的实际运行方式以及网站开发人员如何使用该操作有任何想法,您可以分享吗?或者,如果您能找到可以找到这些信息的位置,您能否指出我正确的方向 - 因为我无法找到它.

解决方案

您至少需要一个 <p> 标签围绕文本,您希望在阅读器视图中看到,并且至少正文内 7 个字 516 个字符.

例如这将触发 ReaderView:

https://stackoverflow.com/a/30750212/1069083

上查看我的示例

Summary

Question

I have had my Firefox upgraded from 38.0.1 to 38.0.5 and have found a new feature called ReaderView - which is a sort of overlay which removes "page clutter" and makes text easier to read.Readerview is found in the right hand side of the address bar as a clickable icon on certain pages.

This is fine, but from the programming point of view I want to know how "reader view" works, which criteria of which pages it applies to. I have done some exploration of the Mozilla Firefox website with no clear answers (sod all programming answers of any sort I found), I have of course Googled / Binged this and this only came back with references to Firefox addons - this is not an addon but a staple part of the new Firefox version.

I made an assumption that readerview used HTML5 and would extract <article> contents but this is not the case as it works on Wikipedia which does not appear to use <article> or similar HTML5 tags, instead the readview extracts certain <div>s and displays them alone. This feature works on some HTML5 pages - such as wikipedia - but then not others.

If anyone has any ideas how Firefox ReaderView actually operates and how this operation can be used by website developers, can you share? Or if you can find where this information can be located, can you point me in the right direction - as I have not been able to find this.

解决方案

You need at least one <p> tag around the text, that you want to see in Reader View, and at least 516 characters in 7 words inside the text.

for example this will trigger the ReaderView:

<body>
<p>
 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
 123456789 123456
</p>
</body>

See my example at https://stackoverflow.com/a/30750212/1069083

这篇关于Firefox 阅读器视图如何操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 00:11