javascript - Find window previously opened by window.open in new tab in chrome -


i have following code (from related) works finding reference opened windows , closing them.

var playerurl = 'http://my.player...'; var popupplayer= window.open('', 'popupplayer', 'width=150,height=100') ; if(popupplayer.location == 'about:blank' ){     popupplayer.location = playerurl ; } popupplayer.focus(); 

this works across tabs in firefox, in chrome seems if each separate tab unaware of happening in other tabs. i'd suspect due each tab being different process there anyway bypass this?

so basically, if open window page in tab a, can reference window page b in tab b, , close in chrome?

related to:

edit:

i found may useful messaging other tabs close action, though haven't tested in chrome: sending message open windows/tabs using javascript

i've used pubsub functionality of jstorage before this. it's dependent on jquery, may not best solution if you're not using it, can check out source code see how works.

include jstorage on tabs , popup windows. on popup windows, add code:

$.jstorage.listenkeychange('fireclose', function(){     window.close() }); 

then, when want close tab:

$.jstorage.set('fireclose', 'anything here, simplicity'); 

you can use second parameter send data other windows if want have more complicated interactions, changing key through jstorage.set sufficient in case.

http://www.jstorage.info/


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -