I'm building a BHO in .NET and i'm testing with IE7 and Win XP Professional. My intention is to do something that is really simple to explain but I'm having lot of troubles at building time. I need to on DocumentComplete event:
1) add some javascript script s to the current document
2) after step 1 is complete call a simple Javascript function located in one of the js file I added before
3) This script just adds a little style to some words on any document loaded into IE window.
Step 3 is done with no problems but I'm having problems with the first to steps.
I tried by different ways (document.parentWindow.execScript, document.body.insertAdjacentHTML for example) but in every way I tested when I add a DIV everything works ok but I tried to add a script then nothing happens.
Any ideas Any help
I give you an example so you can understand better... Imagine I have a script located in
http://myAddress/myScript1.js
that contains
function helloWorldFromJS() { whatever code }
then I need to add to all documents loaded into IE the next two things:
<script language='javascript' src='http://myAddress/myScript1.js'> </script>
and
<script language='javascript' > helloWorldFromJS(); </script>
I can't add both two things.... I will really appreciate your help.
Regards.
Fernando Aramburu