0

I have question :) Can I send message via Web Messaging or not to other tab in browser? For example I have openede my site, and now watching on other site. And when some condition will be pass my site sends messages which makes alert on the other page.

user3025978
  • 477
  • 2
  • 8
  • 27

1 Answers1

0

Assuming you have control over both pages, the answer is "yes", provided you open the second window from the first. window.postMessage only works if you can get a handle to the window. Therefore, if your background site were to invoke window.open() to get to your "other" site, then you could retain a handle to it in your first page's script.

As far as opening it in a tab goes, you'll have to specify that in your browser options.

Community
  • 1
  • 1
Palpatim
  • 9,074
  • 35
  • 43
  • Uh. What, if I have control on first page and second page is, for example facebook? – user3025978 Mar 21 '14 at 20:30
  • 1
    Then you can either petition Facebook to set up an alert API, or write a greasemonkey script or similar to install a message event listener. But it's not something you'll be able to rely on being available for anybody else. – Palpatim Mar 21 '14 at 21:20