I use JavaScript in the bookmarket to fill out form elements on a website:
javascript:var f = document.forms[0];
f.getElementsByTagName('input')[0].value = 'myname';
f.getElementsByTagName('input')[1].value = 'mypassword';
f.getElementsByTagName('input')[2].click
It works. However, what I would like to create is a bookmarklet, so that it opens the landing page and fills in the values ββthere; however, it looks like the page is loaded, other JavaScript codes are not executing. So the following does not work.
javascript:window.location("mywebsite");var f = document.forms[0];
f.getElementsByTagName('input')[0].value = 'myname';
f.getElementsByTagName('input')[1].value = 'mypassword';
f.getElementsByTagName('input')[2].click;
I also experimented with setTimeout to delay the execution of my code, but this did not work.
javascript:var f = document.forms[0];setTimeout("f.getElementsByTagName('input')[0].value = 'myname';f.getElementsByTagName('input')[1].value = 'mypassword';f.getElementsByTagName('input')[2].click;",1000);
How can I load my script as soon as I find out that the landing page is fully loaded?
ustun source
share