-
Notifications
You must be signed in to change notification settings - Fork 6
调研微信读书相关资料 #88
Copy link
Copy link
Open
Labels
Description
需求描述
需要实现在线阅读的统计功能,类似微信读书 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。
Reactions are currently unavailable