views:

214

answers:

1

i'm opening a popup from window a of http://example.com. then close window a and open another window b with same domain, http://example.com. ıs it possible to access popup's DOM from window b and how?

popup is opened from window a by window.open('http://example.com/blah', 'somename', settings..), executing the same from window b with different url like window.open("http://example.com/blah2", "somename" ...) works, which gives a (false?) hint that the popup is accessed by window name. but could not find any way to access to DOM of the popup with or without windowname.

any suggestions?

+1  A: 

Try something like

var newWind = window.open('http://example.com/blah', 'somename',settings);
if (newWind.opener == null) {
    newWind.opener = window;
}
// here you can access DOM of new window
var newDoc = newWind.document;
Mushex Antaranian
this way popup window reloads the url, is it possible to access the dom without reloading the url?
hinoglu
oh.. var newWind = window.open('', 'somename',settings); gives access to window, where window.open('sameurl', 'somename', settings) loads url again. thanks ..
hinoglu