[GH-ISSUE #35] 将Tencent/vConsole置于devtools-detector前加载会导致判断失效 #16

Closed
opened 2026-03-01 14:33:54 +03:00 by kerem · 3 comments
Owner

Originally created by @Becods on GitHub (Jan 13, 2022).
Original GitHub issue: https://github.com/AEPKILL/devtools-detector/issues/35

在DEMO中测试成功 (拉到本地方便插入,除此之外无修改)
Tencent/vConsole置于devtools-detector前加载会导致判断失效

感觉应该无解

Originally created by @Becods on GitHub (Jan 13, 2022). Original GitHub issue: https://github.com/AEPKILL/devtools-detector/issues/35 在DEMO中测试成功 (拉到本地方便插入,除此之外无修改) 将[Tencent/vConsole](https://github.com/Tencent/vConsole)置于devtools-detector前加载会导致判断失效 ![](https://inews.gtimg.com/newsapp_ls/0/14418922345/0) 感觉应该无解
kerem closed this issue 2026-03-01 14:33:54 +03:00
Author
Owner

@AEPKILL commented on GitHub (Jan 18, 2022):

你要保证 devtools-detector 在所有代码之前加载。

这个也可以解决,只要创建一个纯净的运行环境就好了,比如:

var iframe = document.createElement('iframe')
iframe.src = 'about::blank';
iframe.style.display = 'none';
document.body.append(iframe);

iframe.contentWindow.window.console.log( ..... )

但是没必要,因为这个库是你自己主动引入的,你是有能力控制代码的加载顺序的。

<!-- gh-comment-id:1014999752 --> @AEPKILL commented on GitHub (Jan 18, 2022): 你要保证 devtools-detector 在所有代码之前加载。 这个也可以解决,只要创建一个纯净的运行环境就好了,比如: ```javascript var iframe = document.createElement('iframe') iframe.src = 'about::blank'; iframe.style.display = 'none'; document.body.append(iframe); iframe.contentWindow.window.console.log( ..... ) ``` 但是没必要,因为这个库是你自己主动引入的,你是有能力控制代码的加载顺序的。
Author
Owner

@Becods commented on GitHub (Jan 19, 2022):

引用该库主要是为了防止模板被扒
个人测试即使是放在最前也是可以使用fiddler给修改掉的
不过放在iframe里的确是个不错的点子
谢谢你的回复

<!-- gh-comment-id:1016441438 --> @Becods commented on GitHub (Jan 19, 2022): 引用该库主要是为了防止模板被扒 个人测试即使是放在最前也是可以使用fiddler给修改掉的 不过放在iframe里的确是个不错的点子 谢谢你的回复
Author
Owner

@AEPKILL commented on GitHub (Jan 19, 2022):

这个本来就是防君子不防小人的,要想完全隐藏自己的代码可以尝试借助 WebAssembly 或者像 google recaptcha 一样实现一个自己的 vm
或者也可以用 flutter web

<!-- gh-comment-id:1016450789 --> @AEPKILL commented on GitHub (Jan 19, 2022): 这个本来就是防君子不防小人的,要想完全隐藏自己的代码可以尝试借助 WebAssembly 或者像 google recaptcha 一样实现一个自己的 vm 或者也可以用 flutter web
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/devtools-detector#16
No description provided.