1

I am using the following code:

<script type="text/javascript">
    var win;
    win = window.open();
    win.location.href = "somepage";
    win.onload = function () {
        alert(win.location.href);
    };
</script>

somepage redirects to another page, which seems to be creating an unload event. The unload event never gets triggered, but if I change win.onload to win.onunload, it shows the href of the page of tab as soon as it loads, about:blank, and tries to direct to the href for somepage. I'm trying to get the href of the page it redirects to, before closing the page.

SweGoat
  • 5
  • 5
user3377627
  • 363
  • 3
  • 7
  • 22
  • This thread might answer your question: https://stackoverflow.com/questions/3030859/detecting-the-onload-event-of-a-window-opened-with-window-open – SweGoat Aug 01 '19 at 01:18

0 Answers0