AnsweredAssumed Answered

JS property to find if sparkweb is in connected state?

Question asked by amish on Jul 16, 2008

I added small JS in SparkWeb.html, which prevents users from accidentally navigating away (and hence logging out accidentally)

 

function PageUnloading() {
return "You will be logged out of the chat.";
}
window.onbeforeunload = PageUnloading;

This asks user to confirm if he wants to logout when he presses back/forward or types any URL on the location bar.

 

However, the confirmation is asked even when user is not connected yet (i.e. has still not entered username and password)

 

So i wanted to know if there is any parameter that i can test to find if user is logged in.

 

Somewhat like:

 

function PageUnloading() {
if (document.SparkWeb.connected) return "You will be logged out of the chat.";
}
window.onbeforeunload = PageUnloading;

This way confirmation wud not be asked when user has not logged in.

 

Thanks in advance.

Outcomes