Skip to content
New issue

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

调研微信读书相关资料 #88

Open
Dream4ever opened this issue Sep 12, 2020 · 0 comments
Open

调研微信读书相关资料 #88

Dream4ever opened this issue Sep 12, 2020 · 0 comments
Labels
Front-end Everything you see and experience JS Javascript

Comments

@Dream4ever
Copy link
Owner

Dream4ever commented Sep 12, 2020

需求描述

需要实现在线阅读的统计功能,类似微信读书 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年中大厂前端面试总结 这篇文章中还提到了 如何监听你调到了其他页面,具体方法就是监听 documentvisibilitychange 事件:Document.hidden

@Dream4ever Dream4ever added Front-end Everything you see and experience JS Javascript labels Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Front-end Everything you see and experience JS Javascript
Projects
None yet
Development

No branches or pull requests

1 participant