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

禁用浏览器开发者工具 #91

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

禁用浏览器开发者工具 #91

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

Comments

@Dream4ever
Copy link
Owner

Dream4ever commented Sep 18, 2020

需求描述

需要禁用浏览器开发者工具,以免网站代码被查看。

方案调研

在查看微信读书 Web 版的时候,一打开 Chrome 的开发者工具,就始终处于调试代码的状态,无法查看网站源码。

之后在搜索如何禁用开发者工具的时候,在 Stack Overflow 上看到了这篇提问:How to disable browser developer tools?,里面的一个回答用的如下代码,刚好就是微信读书 Web 版所采用的方式:

(function(){
  debugger
}())

在自己的网页上测试了一下这段代码,debugger 只会生效一次。如果要达到微信读书那种无限出现的效果,还得再改改代码。

@Dream4ever Dream4ever added the Front-end Everything you see and experience label Sep 18, 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
Projects
None yet
Development

No branches or pull requests

1 participant