Article ID: 199155
Article Last Modified on 5/11/2006
<HTML>
<HEAD>
<TITLE>Test Page</TITLE>
<SCRIPT LANGUAGE="VBScript">
Dim bLoaded
Dim bUnLoaded
bLoaded = false
bUnLoaded = false
Sub Load
If bLoaded Then
'This indicates the event could be the result
'of a change to the visible property of the
'containing WebBrowser control
Exit Sub
Else
'This is the true onLoad event for the page
bLoaded = true
MsgBox "First onLoad"
End If
End Sub
Sub Unload
If Not bUnLoaded Then
'Again, this indicates we're being fired as
'a result of a change to the visible property
Exit Sub
Else
'This is the final unload of the page
MsgBox "Final onUnload"
End If
End Sub
Function BeforeUnload
bUnLoaded = true
'If this is not the final unload of the page
'then the setTimeout expression will happen.
'If this is the final unload, the page will
'be gone before the setTimeout expression
'occurs.
setTimeout "bUnLoaded = false", 0, "vbscript"
End Function
</SCRIPT>
</HEAD>
<BODY onload="Load" onbeforeunload="BeforeUnload" onunload="UnLoad">
Test Page
</BODY>
</HTML>
Additional query words: kbDSupport onload onunload
Keywords: kbinfo kbwebbrowser kbieobj kbdhtml kbfaq KB199155