How to remove onload event from body tag

I have this page of a government site and using the 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.

How to remove this handler from attached javascript code? Since I need to remove it using the JS code attachรฉ in the Google Chrome extension.

I have not tried this code in Google Chrome Extension yet. First, I want it to work using the developer console.

+5
source share
1 answer

The following jQuery will remove the onload function from your body tag:

 $('body').off('load'); 

Read more about off here

0
source

All Articles