Access a window by window name

后端 未结 7 1138
悲哀的现实
悲哀的现实 2020-11-29 07:08

If I open a window using

window.open(\'myurl.html\', \'windowname\', \'width=100,height=100\');

How do I refer to the new window (from the

相关标签:
7条回答
  • 2020-11-29 07:53

    If you didn't save a reference to the window then there is no way to restore it. However, if that window is still open and if the page loaded there belongs to the same domain as your page, you can run JavaScript code in it:

    window.open("javascript:doSomething()", "windowname");
    

    Whether that's sufficient in your scenario depends on what you are trying to achieve.

    0 讨论(0)
提交回复
热议问题