Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Wed, 2 Jul 2008 12:20:03 -0700 (PDT),    group: microsoft.public.dotnet.framework.interop        back       


IHTMLWindow2 onunload event not triggered consistently   
Working in C#:

In IE's document complete event handler
(DWebBrowserEvents2_DocumentCompleteEventHandler), using the web
browser object Document member as HTMLDocument and using the
parentWindow member as IHTMLWindow2 and HTMLWindowEvents2_Event, I add
an event handler in the form of an anonymous delegate to the onunload
member of HTMLWindowEvents2_Event.

I find that in most pages, the onunload event triggers as expected.
However, in other pages, like cnn.com, I find that a number of frames
do not ever trigger the onunload event.  Looking through the source of
one of the frames, I come across this:

=============================================================
http://i.cdn.turner.com/cnn/.element/js/2.0/csi_include.js

var oldonloadfunction = window.onunload;
function dummyonunload(evt)
{
	if(oldonloadfunction)
	{
		oldonloadfunction(evt);
	}
}
window.onunload=dummyonunload;

=============================================================

I haven't traced through all the frames that are loaded to see when
this is invoked, but I wonder if it's possible that a statement like
this would somehow "detach" the delegate that's supposed to handle the
window.onunload event.

Whether or not that is the case, is there a way to make sure the
onunload event fires when it's supposed to?

Thanks.
date: Wed, 2 Jul 2008 12:20:03 -0700 (PDT)   author:   unknown

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us