homepage Welcome to WebmasterWorld Guest from 54.204.141.129
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Clicking on Back button terminates Ajax web IM
sasha




msg:1476552
 3:21 am on Jun 27, 2006 (gmt 0)

I am building a web based (ajax) IM application that connects web visitors with webmasters called SNIMMER. The problem that we have encountered is that during an IM session if a user clicks on the browser "Back" button the session terminates.

I imagine this is standard javascript behavior - clicking on "Back" button resets existing javascript state and breaks the IM session.

Even preventing the "Back" click with a javascript pop-up does not work. While the user receives a js alert and has a choice to remain on the previous page - it still re-sets the javascript state and the IM session is lost. The same problem also arises when a user wants to closing the browser. We can generate a pop up, but cannot preserve the existing session.

Does anyone have any suggestions on how to tackle this? Is there a way to deal with this in javascript or flash?

 

sasha




msg:1476553
 7:47 pm on Jun 28, 2006 (gmt 0)

I found a solution (sadly without help of anyone on this forum).

window.onbeforeunload = function()
{
if(VAR.nIHC.person.jT.chatMode=="publisher-chat")
{
window.event.returnValue = "Your current chat session will terminate.";
}
};
//for Firefox

//window.onbeforeunload = function() {return("Your current chat session will terminate.");}

adni18




msg:1476554
 4:37 pm on Jun 30, 2006 (gmt 0)

Maybe you could try storing the session in a cookie and then check for cookie-stored sessions and resurrect them when the previous page has loaded?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved