0
這個HTML是基於以前的解決方案發現here:從System.Windows.Forms.WebBrowser訪問HTMLObjectElement失敗
<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>
這工作,當我把它加載到IE瀏覽器,我期望(版本10)在我的桌面上運行。然而,當我把它加載到一個用戶控件一個web瀏覽器對象它不工作 - 警報返回不同的對象(請參閱該線路上的評論),然後抱怨說:
Object doesn't support property or method 'addEventListener'
爲什麼沒有web瀏覽器的行爲像桌面上的IE瀏覽器?