简体   繁体   English

JavaScript-网站可以看到用户脚本生成的错误/控制台日志吗?

[英]JavaScript - Can a website see userscript generated errors/console logs?

Is it possible in any way for websites to detect the usage of userscripts by any errors that the user may experience from that userscript? 网站是否有可能通过用户从该用户脚本中遇到的任何错误来检测用户脚本的使用情况?

Say that a website administrator wants to catch userscripters by changing something in the website that then causes object selectors in the userscripts to fail. 假设某个网站管理员想要通过更改网站中的某些内容来捕获用户脚本,然后导致用户脚本中的对象选择器失败。 Can the website know about the errors caused by a failing userscript and or can they in some way read the console.log()'s created by the userscript? 网站可以知道由失败的用户脚本引起的错误,还是可以某种方式读取用户脚本创建的console.log()?

This is not a question about DOM modification. 这不是有关DOM修改的问题。

Brock, this may be your field. 布罗克,这可能是您的领域。 :) :)

A website can check their DOM to see if the page has been modified in ways that are not done by their own code. 网站可以检查其DOM,以查看页面是否已被其自己的代码未完成的修改。 So, if a userscript was modifying the page in some way, a website could potentially detect that modification (they'd have to be looking for it). 因此,如果用户脚本以某种方式修改了页面,则网站可能会检测到该修改(他们必须在寻找它)。

A website can replace console.log() with their own function that captures any output sent to it (this would be actual console.log() statements in your code, not other messages the system puts in the console (such as uncaught exceptions). 网站可以用自己的函数替换console.log() ,该函数捕获发送给它的任何输出(这将是代码中的实际console.log()语句,而不是系统放入控制台的其他消息(例如未捕获的异常) 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM