We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
需要实现在线阅读的统计功能,类似微信读书 Web 版。
Google 搜索 微信读书:关键词太泛泛,没什么可用的参考资料。
微信读书
GitHub 搜索 微信读书:找到一个微信读书自动阅读器:DoooReyn / WxRead-WebAutoReader,就是简单地挂机,自动翻页,自动点击下一章。
直接查看微信读书 Web 版的源码,发现一打开 Chrome 的开发者工具,就会始终停留在调试状态,应该是为了防止被查看到代码所做的反制措施。
又想起来,公司现在做的 H5 电子书,翻页的话 URL 会变化,从 index.html 变成 index.html#p=2。这样的话,是不是可以通过监听 URL 的变化来判断用户是否翻页?
index.html
index.html#p=2
Google how to detect url change,看到了 How to detect when the browser URL changes with vanilla JS 这篇文章,可以参考一下。
how to detect url change
上面这篇文章还提到了 popstate 事件,MDN 官方文档在此:Window: popstate event。
popstate
逛技术社区的时候,在 2020年中大厂前端面试总结 这篇文章中还提到了 如何监听你调到了其他页面,具体方法就是监听 document 的 visibilitychange 事件:Document.hidden。
如何监听你调到了其他页面
document
visibilitychange
The text was updated successfully, but these errors were encountered:
No branches or pull requests
需求描述
需要实现在线阅读的统计功能,类似微信读书 Web 版。
方案调研
微信读书
Google 搜索
微信读书
:关键词太泛泛,没什么可用的参考资料。GitHub 搜索
微信读书
:找到一个微信读书自动阅读器:DoooReyn / WxRead-WebAutoReader,就是简单地挂机,自动翻页,自动点击下一章。直接查看微信读书 Web 版的源码,发现一打开 Chrome 的开发者工具,就会始终停留在调试状态,应该是为了防止被查看到代码所做的反制措施。
电子书翻页
又想起来,公司现在做的 H5 电子书,翻页的话 URL 会变化,从
index.html
变成index.html#p=2
。这样的话,是不是可以通过监听 URL 的变化来判断用户是否翻页?Google
how to detect url change
,看到了 How to detect when the browser URL changes with vanilla JS 这篇文章,可以参考一下。上面这篇文章还提到了
popstate
事件,MDN 官方文档在此:Window: popstate event。逛技术社区的时候,在 2020年中大厂前端面试总结 这篇文章中还提到了
如何监听你调到了其他页面
,具体方法就是监听document
的visibilitychange
事件:Document.hidden。The text was updated successfully, but these errors were encountered: