views:

233

answers:

2

Hi All

I am developing a chat application(Customer and operator). Using jquery Ajax and PHP . From customer side he can handle multiple chat.. For example ha have two chat.. How he knows in which window the new msg comes.. I can take the count . But is there any option in jquery to blink the window when count change ?

A: 

If you are referring to flashing the task bar button, no, there is no mechanism to do that.

Daniel A. White
No i'm not thinking about that ... i need to just know in which window the new chat come . But i cant use the alert :(
Nisanth
+2  A: 

I would recommend not using "real" (popup) windows but using CSS-Layers.

So if a new chat message from someone different comes in, e.g. a div container with the ID "chatSessionXXX" is being created in which the dialog happens. You can then always use this ID as your current chat session ID when saving or displaying messages via AJAX.

When a new message comes in, you could also move the layer on top by adjusting the z-index or simply add a CSS class that adds some "flashy" effect to that container.

But if you want to rely on real popup windows you could use focus() to get the window to the foreground.

/* Inside your chat popup */
if(newMessage) 
    window.focus();

You may also encounter a problem when you want to terminate a chat session when a popup is closed by a user - the unload and beforeunload event is not reliable and may not work correctly in some browsers (at least as far as my experience goes on this one).

Alex
Thank u Alex .. I will try this with ur suggestion :)
Nisanth