Inject js file in website

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

Inject js file in website
 
Vinesh Chauhan




Posts: 5
Joined: 2016-09-06
Hi,

I need your guidance in achieving below mentioned things.

I want to capture window event for specific domain website. In js file, there are window listener configured to capture event like click, form submit. Each event is bind with function that returns captured element details to record. How do I inject js file in website of particular domain ?

e.g.
window.addEventListener("click", this.onClickEvent, true);
Posted 12 Sep, 2016 01:06:08 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Vinesh,

Please try the code below.


 mshtml.IHTMLScriptElement scriptObject =
                            (mshtml.IHTMLScriptElement)HTMLDocument.createElement("script");
                        scriptObject.type = @"text/javascript";
                        scriptObject.text = "
" + scriptText + "
";
                        ((mshtml.HTMLBody)HTMLDocument.body).appendChild((mshtml.IHTMLDOMNode)scriptObject);
Posted 12 Sep, 2016 04:48:12 Top