renn
09-05-2002, 11:49 PM
My programming background is in perl/php etc.. having trouble with this simple javascript issue ..
Basically, the php app opens a new window and everything happens there, people have chat discussions with eachother etc..
My problem is that if a user clicks a link outside of their browser (outlook, IM,ICQ) which my customers use often, then the link loads into the chat session breaking the connection.
I cant simply have an unload message such as..
window.onbeforeunload = unloadMsg ;
function unloadMsg()
{
msg = "You are leaving the page, click cancel to stay."
return msg ;
}
because in my php code when someone enters a line of text, it accesses a second php file (wherein leaving the first page) and prompting the user if they want to leave the page.. and prompting again when it comes back to the initial chat page.
The solution is to somehow check the root domain of the incoming hyperlink and check that to our domain that we set in a variable.. if they are the same, ignore the command, else prompt the user with the above message explaining they are leaving the page..
Any suggestions on the coding would be greatly appreciated
Reggie
Basically, the php app opens a new window and everything happens there, people have chat discussions with eachother etc..
My problem is that if a user clicks a link outside of their browser (outlook, IM,ICQ) which my customers use often, then the link loads into the chat session breaking the connection.
I cant simply have an unload message such as..
window.onbeforeunload = unloadMsg ;
function unloadMsg()
{
msg = "You are leaving the page, click cancel to stay."
return msg ;
}
because in my php code when someone enters a line of text, it accesses a second php file (wherein leaving the first page) and prompting the user if they want to leave the page.. and prompting again when it comes back to the initial chat page.
The solution is to somehow check the root domain of the incoming hyperlink and check that to our domain that we set in a variable.. if they are the same, ignore the command, else prompt the user with the above message explaining they are leaving the page..
Any suggestions on the coding would be greatly appreciated
Reggie