0

This HTML is based upon a previous solution found here:

<body>
<object data="C:\Dts\AipDirs\Eg\MarsOutputStore\_AD2_LFBD_000.svg" id="alphasvg" width="100%" height="100%" type="image/svg+xml"></object>
<script>
    var a = document.getElementById("alphasvg");

    alert (a); // Displays [object HTMLObjectElement] when page is loaded into IE on desktop, but [object] when loaded into System.Windows.Forms.WebBrowser

    // it's important to add an load event listener to the object, as it will load the svg doc asynchronously
    a.addEventListener("load",function(){

        alert ("in addEvenetListener for load");       

    },false);
</script>

and this works as I'd expect when I load it into IE (version 10) running on my desktop. However, when I load it into a WebBrowser object in a UserControl it doesn't work - the alert returns a different object (see comment on that line) and it then complains that:

Object doesn't support property or method 'addEventListener'

Why does WebBrowser not behave like IE on the desktop?

Community
  • 1
  • 1
RAM
  • 475
  • 1
  • 3
  • 14

1 Answers1

1

This seemed to fix it:

<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

WebBrowser and IE have different default compatibility modes for intranet documents and I was loading the HTML file from the local file system. Maybe that's got something to do with it?

RAM
  • 475
  • 1
  • 3
  • 14