I've this government site page and using developer console I want to remove the onload event attached to the body tag by entering this code in the console:
var script = document.createElement("script");
script.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.head.appendChild(script);
//wait for jquery library to load
setTimeout(function(){
$("body").unbind("onload");
$("body").get(0).onload = null;
}, 3000);
But that does not work.
What is the way to remove this handler from attached javascript code? Since I'll need to remove it using an attache JS code in Google Chrome Extension.
I've not yet tried this code in Google Chrome Extension. First I want to make it work using developer console.
The following JQuery will remove the onload function from your body tag:
$('body').off('load');
See more about off
here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With