Contents - Index - Top


EdgeBrowser.html

 

The content of the EdgeBrowser.html page looks like this:

 

<html>

  <body onload="InitBrowser()">

    <object id="AntView" height="600" width="800" classid="CLSID:7e146b1d-42ed-4386-904f-9a9edb61f9ae">

       <param name="AxBorderStyle" value="2">

       <param name="CreateWebViewOnCreate" value="-1">

       <param name="Enabled" value="-1">

    </object>

    <button onclick="BrowseToUrl()">Go</button>

  </body>

<script language="javascript">

  function InitBrowser() {

    var EdgeWebBrowser = document.getElementById("AntView");

    EdgeWebBrowser.UnlockControl("ExampleCompany","WI5PO2-2KSU3Q-HWFXFU-IUMU2V-QF8P2F");

    EdgeWebBrowser.CreateWebView();

  }

 

  function BrowseToUrl() {

    var EdgeWebBrowser = document.getElementById("AntView");

    EdgeWebBrowser.Navigate("https://www.whatismybrowser.com");

  }

 

</script>

<script for="AntView" event="OnCreateWebviewCompleted(HResult)">

  if (HResult !== 0) {

    alert("OnCreateWebviewCompleted HResult = " + HResult.toString());

  }

</script>

<script for="AntView" event="OnProcessFailed(ExitCode,FrameInfos,Description,Failed,Reason)">

    alert("Creation process failed. Error = " + ExitCode.toString());

</script>

</html>

 

The AntView control is instantiated via the "object" tag. The object knows how-to instantiate the AntView control by providing the correct CLSID GUID string for the classid attribute.

Via the parameters you can override some of the default properties, note here that the value "-1" is equal to "True".

The body onload javascript function shows you how you can invoke methods on the control during startup.

The click event for the "Go" button is set to the BrowseToUrl function which navigates the browser control to the whatismybrowser website.

The two script snippets at the bottom display how to get access to events triggered by the control.

 


AntView - The MS Edge WebView2 ActiveX control Date last changed: 09/25/2024