Favicon disappears after preventing execution of a specific inline script tag by Tampemonkey
- 阅读更多 关于 Favicon disappears after preventing execution of a specific inline script tag by Tampemonkey
问题 I use this code in Tampermonkey to prevent certain script tag from executing: https://stackoverflow.com/a/50024143/8849796 (function() { 'use strict'; window.stop(); const xhr = new XMLHttpRequest(); xhr.open('GET', window.location.href); xhr.onload = () => { var html = xhr.responseText .replace(/<script\b[\s\S]*?<\/script>/g, s => { // check if script tag should be replaced/deleted if (s.includes('window.location')) { return ''; } else { return s; } }); document.open(); document.write(html);