catch javscript changes DOM elements

Add-in Express™ Support Service
That's what is more important than anything else

catch javscript changes DOM elements
ADXIEModule event to catch javscript changes DOM elements 
mark kwan




Posts: 4
Joined: 2010-04-26
Hi, we're using ADXIEModule .IE.ADXIEDocumentComplete_EventHandler to change the html that is being displayed to the user on web pages.

The trouble is that some web pages change their content using javascript and this occurs after this event. I looked at the available events and could not find any "OnJavascriptChangeDOM" type of handlers.

Also, refreshing the page doesn't cause the ADXIEDocumentComplete_EventHandler to fire again, so our html changes are lost.

I was thinking of adding my own javascript (executed on a timer) and using it to change the html, but that could be problematic too.

I know this is possible, as other companies made this work (skype). Any suggestions? (Add-in Express 2009 for Microsoft Office and .net, Standard)
Posted 26 Apr, 2010 22:16:59 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Mark.

Unfortuantely there is not such event in the IE object model. And the DocumentComplete event doesn't fire when you press F5 in IE. This is a known issue. We don't have any reliable solution for this.

I know this is possible, as other companies made this work (skype).

How can I see such functionality in action?
Posted 27 Apr, 2010 10:36:00 Top
mark kwan




Posts: 4
Joined: 2010-04-26
Note that I am in the USA
To see skype work, 1) just install skype. Make sure on the first installation dialog - options button you check install IE toolbar. You don't need an account.

2) go to any web page with phone numbers on it - I use google and search for "stores". You will see the phone numbers with a little phone icon next to it and the text changed to an image with skype options on the left (such as which country). Sometimes google web pages use javascript to populate the search results - and skype still works.

3) you can also create a web page that changes the contents using javascript (1 second after finish loading). Here's my sample. Skype will also change the phone number on this page. Note that this code is not directly copyable because this editor changes certain characters.


<ht ml><head></head><body>
<div id="mydiv">asdf</div>
<sc ript>
setTimeout("tick_display()", 1000);

function tick_display() {
    document. getElementById ("mydiv"). innerHTML = "425-242- 3212";
}
tick_display();
</script>
</body></html>
Posted 27 Apr, 2010 13:36:50 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Mark.

Thanks for the code. I will investigate this issue and hopefully send you a sample code to implement such functionality.
Posted 30 Apr, 2010 09:45:01 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Mark.

I found that when you change the content using javascript, the OnPropertyChange event of the corresponding element fires.
Posted 17 Jun, 2010 09:35:14 Top