Disabling a page's focus-checking function using GM [duplicate]

穿精又带淫゛_ 提交于 2019-12-06 08:50:14
Brock Adams

In general, to surgically disable or alter a page's javascript, use checkForBadJavascripts as shown in "How to alter this javascript with Greasemonkey?".

However, in this case, the page is using document.hasFocus(), so it should be enough to just hijack that:

// ==UserScript==
// @name     _YOUR_SCRIPT_NAME
// @include  http://YOUR_SERVER.COM/YOUR_PATH/*
// @run-at   document-start
// @grant    none
// ==/UserScript==

document.hasFocus = function () {return true;};
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!