2

I got two browser windows on the same domain,

one is the main window and the second is small popup window.

i found this: How to Communicate between two browser windows?

but, the problem is the popup opens as event on the local computer by 3rd party software... and i don't wish to communicate back to the server, and reading the status at the main window, for slow time issues..

i wish to transfer some data from the popup directly to the main window via JS (and close the popup right after).

the event is a VOIP new income call opened by the local phone soft dialer with parameters, and the main window is a browser CRM that will need to show incoming call status via JS on the same page, AJAX-like [only local].

p.s:

maybe there is a way to communicate between browser to windows application?, so the 3rd party software will send data to it and the application will communicate to the window (or Firefox extension - but i prefer without the need to install more addons)...

what approach should i take? what do you think is the solution?

thanks allot. ;)

Community
  • 1
  • 1
itai
  • 302
  • 5
  • 15
  • i think i will go with dailer->bridge application->addon[via socket]->js communication.... the dialer will execute a command instead of popup, execute and send parameters to local application i'll write, that communicate with firefox addon via socket to local host communication and calling alocal js with the parameters... complicated but fast and clean. – itai Apr 23 '13 at 13:06

2 Answers2

4

If the one browser does not open up the other browser, there is no way for the two browsers to talk through window.opener.

What you could try is storing data into localstorage and have the windows poll localstorage for changes.

epascarello
  • 204,599
  • 20
  • 195
  • 236
  • can i manipulate local storage using c++ windows application to firefox addon communication? to avoid open&close mini popup... thanx – itai Apr 23 '13 at 12:34
  • 1
    or the old 90's trick.. `window.name` because localStorage might not be available. but then u'd have to use an interval to "listen" to changes and act upon them..suck. – vsync Jun 10 '14 at 12:59
  • Also, using `localstorage` as suggested is only for same-domain. so you couldn't use the `storage` listener unless you are opening 2 separate windows from the same domain. – vsync Jun 15 '14 at 15:53
  • 2
    if using `locaStorage`, you don't need to poll for changes, but rather add an event listener `window.on('storage')` which will fire in all windows apart from the one that set the value. – ismriv Feb 10 '15 at 23:39
2

Have you tried using window.opener to refer to the parent window?

plalx
  • 42,889
  • 6
  • 74
  • 90
  • no, i will try, window.opener will return the parent of the window, but it interesting to know if it has a parent, cause 3rd party software opened it.. not the 'parent' i looking for.., it's kind like 2 separate browser windows communication... – itai Apr 23 '13 at 12:14
  • Right, well since I had no idea how the third party software was opening the window (could have executed a command in the scope of the main browser window), it was worth saying ;) – plalx Apr 23 '13 at 12:31