onbeforeunload and iframe based application

A

ajaykumarsinghal

Hi,

I am working on an iframe based application and need to warn user when
they navigate to anyother site or close the browser. To do this i
tried following:

<script language='javascript'>
window.onbeforeunload = unloadMessage;


function unloadMessage() {
window.focus();
window.event.returnValue = "If you continue
all applications will be closed automatically!"
}
</script>

It works when user types anyother site in the address bar and try to
close the browser. But when user navigates within site and we show
different content in iframe this event fires in those cases as well.

Is there any way to ignore this event for content change within iframe
and keep on working for entire browser window?

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top