Is there a way to see which functions are being executed on a page?
If I load an external script on a page, is it possible to change what a function does on the fly or prevent it from running?
Is there a way to see which functions are being executed on a page?
If I load an external script on a page, is it possible to change what a function does on the fly or prevent it from running?
HTML5 introduces onbeforescriptexecute event, which you can use to detect new scripts on the fly, and block them if you want.
For example:
window.addEventListener('beforescriptexecute', function(e) {
// e.target.src is the URL of the external loaded script
// e.target.innerHTML is the content of the inline loaded script
if (e.target.src === urlToBlock)
e.preventDefault(); // Block script
}, true);
https://developer.chrome.com/devtools/docs/javascript-debugging Here's a good place to start.