I'm making a bookmarklet that adds a <script>
link to a javascript file on my website. Then it will run the function. I can't get it to run, though. window.onload
doesn't work, as the page has already loaded when the link is added. I'm wondering if there's something that will trigger a function when the javascript is linked.
New Update: I found a solution. I used setTimeout()
.
setTimeout(function() {
//code here
}, 0);
Putting 0 does seem to work. Thanks for the help, though!