Discussion:
HTML document recognition...
(too old to reply)
Arrian
2003-10-22 17:35:26 UTC
Permalink
Hi,

I am trying to develop an algorithm for recognising the current HTML
document within an instance of IE (5.5 or above), and when it changes what,
exactly, has changed. Using a BHO (written in VC++ v.6 SP5) I can quite
happily mess about with the current running document using the DOM, setting
text in INPUTS, selecting radio buttons and checkboxes, clicking buttons and
links, etc.. But what I need to do is to recognise when one action modifies
the current document (by changing text, adding a table or controls, etc.)
and to be able to locate, precisely, in the DOM what has changed. Of course
this process is made all the more difficult if the current running document
is actually a frameset as then the code would need to take into account all
the documents in each frame as well.

Does anyone know the best way of doing this? (Or indeed any way...)

Currently my thinking is along the lines of a detailed comparison of either
the DOM's innerXML string or the DOM's entire node structure (or both!), but
I would gladly hear other opinions as I fully realise that C++ is not the
best at string manipualtion.

Thanks in advance.

Mike
David Lovell [MSFT]
2003-10-29 21:01:04 UTC
Permalink
Perhaps you could just create a global event handler on the <body> element
for any types of changes. Then that event handler can use the global event
object to identify the originating tag that the change was fired from. All
events on all elements will eventually bubble up to the <body> element and
you could track all the events there. (Rather than comparing the whole
document contents.

Alternatively, you could set onChange on the <body> element and do some kind
of diff on the body.InnerText property.
--
Thanks,
David W. Lovell

This posting is provided "AS IS" with no warranties, and confers no rights.

If a script was included within this post, use of included
script samples are subject to the terms, specified at
http://www.microsoft.com/info/cpyright.htm"

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
Post by Arrian
Hi,
I am trying to develop an algorithm for recognising the current HTML
document within an instance of IE (5.5 or above), and when it changes what,
exactly, has changed. Using a BHO (written in VC++ v.6 SP5) I can quite
happily mess about with the current running document using the DOM, setting
text in INPUTS, selecting radio buttons and checkboxes, clicking buttons and
links, etc.. But what I need to do is to recognise when one action modifies
the current document (by changing text, adding a table or controls, etc.)
and to be able to locate, precisely, in the DOM what has changed. Of course
this process is made all the more difficult if the current running document
is actually a frameset as then the code would need to take into account all
the documents in each frame as well.
Does anyone know the best way of doing this? (Or indeed any way...)
Currently my thinking is along the lines of a detailed comparison of either
the DOM's innerXML string or the DOM's entire node structure (or both!), but
I would gladly hear other opinions as I fully realise that C++ is not the
best at string manipualtion.
Thanks in advance.
Mike
Loading...