0

I m currently building a facebook style notification system for my site.

I m using long polling. So, the server sends data if its available and closes the connection.

Now the problem i m facing is that, i want it to share across all open tabs or windows of that browser.

I m using a cookie to detect if a tab is already executing the ajax call, so other tabs will not execute it until the operation of the first tab is complete.

Now what i want is, to have an effective way, so that i can show the data across all open tabs in the form or a small fb style popup box.

The goal is if the last active ajax call has some data, then a small popup box will show up on all open browser tab or windows.

As, a theory i may be able to do it via cookie, but i want to know if there is some better way to do that.

Thanks, Anjan

anjan
  • 3,147
  • 6
  • 26
  • 31
  • Browsers don't let pages talk to other pages. You'd have to make an extension to get around the cookie. – beatgammit Apr 05 '11 at 19:29
  • So, i would have to settle for cookies? in HTML5 there is something like localStorage, i guess there is nothing similar in XHTML. – anjan Apr 05 '11 at 19:36
  • Yeah, HTML5 has a cache manifest type thing, but I wouldn't depend on it yet. It isn't even a standard yet, much less supported by browsers. AFAIK, it's only available on Chrome and Safari (maybe Opera, but I'm not sure). – beatgammit Apr 05 '11 at 19:43
  • Haha, yum. I'll go ahead and create an answer. – beatgammit Apr 05 '11 at 19:56

1 Answers1

0

Browsers don't let pages talk to other pages. You'd have to make an extension to get around the cookie.

If you're ok with the cookie idea, follow these examples:

Community
  • 1
  • 1
beatgammit
  • 19,817
  • 19
  • 86
  • 129
  • You wouldn't need an extension to do this: there are other ways to [send messages between tabs](https://stackoverflow.com/a/28230846/975097) on the client-side (using [postMessage](https://stackoverflow.com/a/10885966/975097), for example). – Anderson Green Oct 30 '20 at 03:39