Welcome Guest Search | Active Topics | Sign In | Register

Access IHTMLScriptElement and append new function Options
Clarence
Posted: Wednesday, January 19, 2022 4:09:22 AM
Rank: Member
Groups: Member

Joined: 9/29/2019
Posts: 13
Hi,

Using InternetExplorer, after loading a page successfully, I IHTMLScriptElement as follow to add function...

HtmlElement eHead = IE.Document.GetElementsByTagName("head")[0];
HtmlElement eS = IE.Document.CreateElement("script");
IHTMLScriptElement eScript = (IHTMLScriptElement)eS.DomElement;

eScript.text = "function Configure() { alertJSONArray[0].fastTrain = false; }";
eHead.AppendChild(eScript);
IE.Document.InvokeScript("Configure");

How can EO Browser achieve the above?

I could EO.WebBrowser.DOM.Element eHead = WebDoc.getElementsByTagName("head")[0];
But there was no method in EO Browser to append the new function to eHead... kindly advise.
eo_support
Posted: Wednesday, January 19, 2022 1:15:08 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
Hi,

You would just use WebView.EvalScript to run JavaScript in the page. See here for more details:

https://www.essentialobjects.com/doc/webbrowser/advanced/js

There is no IHTMLScriptElement in EO.WebBrowser because this is an interface implemented by IE and EO.WebBrowser is based on Chromium, not IE.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.