Change the url of an open popup window
P粉348915572
P粉348915572 2024-03-25 17:35:47
0
2
564

Whether it is possible to change the url of the pop-up window.

Suppose I open a popup window:

function pop1(){
    window.open('http://google.com','wind1');   
}

Can you change the URL of the pop-up window "wind1" to "http://msn.com". Something with location.href or any other solution.

P粉348915572
P粉348915572

reply all(2)
P粉204136428

For me, when I only changed the end of the url (parameter part), I used a little trick: Load different urls before using new similar urls. I chose to use "about:blank", but any website URL can be used.

self.location = "about:blank";
self.location = desired_url;

//this code works fine both in Mozilla Firefox as in Chrome

Please note that location = site; is the same as location.href = site.
I only use location.href to read the current url.

P粉135292805
var w1 = window.open('http://www.canop.org','wind1');

w1.location.href='http://www.google.com';
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template