Two bugs with onscroll event?

Two bugs with onscroll event?

Post by Zach » Sat, 12 Mar 2005 02:37:15


I have some C++ / ATL objects which are trying to capture the onscroll
event of whatever page(s) is/are being displayed to the user. My basic

flow of setting up this event handlers are:


1) Sink with the DWebBrowserEvents2 of the pointer that is given to the

SetSite() method of my Browser Helper Object.
2) In DocumentComplete(), get a pointer to the IHTMLWindow2 interface
associated with the IWebBrowser2 object given to me. Sink with
HTMLWindowEvents2 on this IHTMLWindow2 interface using AtlAdvise.
3) In BeforeNavigate2, disconnect from the sink on the IHTMLWindow2
interface by using AtlUnadvise.

The two issues I am experiencing are:


a) On about 95% of webpages, I am able to catch onscroll events for
every frame in the page using this method. However, on some webpages
onscroll does not get fired AT ALL. One particular page that this
happens on is www.yahoo.com. Even though AtlAdvise returned S_OK, the
IDispatch::Invoke that I passed it never gets called with
DISPID_HTMLWINDOWEVENTS2_ONSCRLL. This IDispatch interface DOES get
called with other events, such as onunload, etc. It seems like only
the onscroll method is not working correctly.

b) I've only seen this happen on one website (www.wikipedia.org). I
actually do get onscroll events whenever I should, and I then get the
IHTMLWindow2 interface that I originally called onscroll on. I query
for the IHTMLBody2 interface, and ask for scrollTop and scrollLeft.
They ALWAYS return 0, regardless of where the scrollbar is located. On
every other page I have ever tested, the exact same code works just
fine.

I'm not sure if either / both of these are bugs or user error. But any
advice would be appreciated.

Sincerely
Zachary Turner
 
 
 

Two bugs with onscroll event?

Post by Igor Tande » Sat, 12 Mar 2005 03:02:04


www.yahoo.com seems to work fine for me.


See

http://www.yqcomputer.com/

--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925

 
 
 

Two bugs with onscroll event?

Post by Zach » Sat, 12 Mar 2005 06:16:34

Hmm... That's very interesting.. It seems I can determine whether or
not strict-compatibility mode is enabled by using
IHTMLDocument5::get_compatMode



As far as the www.yahoo.com case is concerned, I wonder if our browsers
are each loading something different when we go to www.yahoo.com.
Perhaps due to some server side logic on the part of Yahoo. In any
case, when I view source on Yahoo.com, it's DOCTYPE flag is

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> Does
that signal any warning bells?

I'll try to get the compatMode on that also and see if it's strict, but
I suspect something else is going on in that case. Main reason being
that the symptoms are different. On yahoo I don't even get a scroll
event, whereas on wikipedia I do get a scroll event, but the positions
are set at 0.

Thanks again
 
 
 

Two bugs with onscroll event?

Post by Igor Tande » Sat, 12 Mar 2005 06:25:18


I see the same. Nothing special about it.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925