vendredi 10 novembre 2017

Triggering window.onload with var window

I'd like to load a page via Javascript, then use Javascript to fill out a form. But of course it can't fill out the form until the form loads. But I don't know how to make it wait until another window loads, not just the window it's running in. For example:

<html>
<body>
<script>
    var myWindow = window.open("https://www.google.ca/");
    myWindow.onload = function(){
    alert("It's loaded!");
}
</script>
</body>
</html>

I don't ever see the alert "It's loaded!". Is there another function that I need to use for the event of a different window opening, or is there some other way to make this work?




Aucun commentaire:

Enregistrer un commentaire