【发布时间】:2014-02-20 09:04:49
【问题描述】:
此 HTML 基于之前找到的解决方案 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>
当我将它加载到在我的桌面上运行的 IE(版本 10)中时,它可以正常工作。但是,当我将它加载到 UserControl 中的 WebBrowser 对象中时,它不起作用 - 警报返回一个不同的对象(请参阅该行的注释),然后它抱怨:
Object doesn't support property or method 'addEventListener'
为什么 WebBrowser 在桌面上的行为不像 IE?
【问题讨论】:
标签: javascript html .net svg webbrowser-control