« Back to APIs

How can I get the client object in the popup page for the jabber IM for Web

Combination View Flat View Tree View
Threads [ Previous | Next ]
The IM & presence for Jabber for Web that I am developing is using 2 web pages. first page is for list of users with presence and Second page is for chatting. I declared the client parameter in the first page and I implement the list of users with presence. When I click the one of list of Users, I'm wondering How I can get the client object in the second page[popup chatting page] for chatting. Please Help me....

Hi You-young,
Sorry for the delayed reply.
Is the "second page for chatting" opened from the first one (list of users) ? In this case the chatting page should be able to access the first page through window.opener, and the popup could use window.opener.client after the first page sets it as window.client = new jabberwerx.Client(<resource>).
https://developer.mozilla.org/en-US/docs/DOM/window.opener
Does your application target any particular browser ? If HTML5 is supported, you could use a web worker to load jabberwerx and initialize the client variable in the background (worker script), and the 2 pages would exchange message with the web worker, assuming they are both loaded from the same domain.
https://developer.mozilla.org/en-US/docs/DOM/Using_web_workers
Finally, if your application is meant to run in Firefox or Chrome only, you could use a browser extension to share a background (invisible) page between as many pages/tabs as needed.
Note I have not tested any of the suggested solutions ;-)
Thomas