The function below is called as soon as the body
is loaded.
document.body.onload = function(){console.log('loaded!')}
I want this same code to be executed, however, by inserting it in the URL bar of the Google Chrome browser.
javascript:function f1(){
window.location.href='https://www.w3schools.com/'};
function f2(){
document.body.onload = function(){
console.log('loaded!')
}
};
f1();
f2();
The f2
function should only be called when the f1
function is fully executed. I imagine this is enough for console.log()
to be called successfully.