Is there a way to monitor javascript functions running on a page?
dom, javascript
Solution
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);
Problem
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?