对象不支持属性或方法WebBrowser控件 [英] Object doesn't support property or method WebBrowser Control

查看:6210
本文介绍了对象不支持属性或方法WebBrowser控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我公司开发的移动应用程序(在asp.net)和我使用的WebBrowser控件WinForms应用程序试玩吧。

I have developed a mobile app (in asp.net) and I am using a WinForms application with the WebBrowser control to demo it.

我在我的主网页我使用一个脚本来隐藏地址栏:

I my main page I am using a script to hide the address bar:

<script type="text/javascript">
    window.addEventListener("load", function () {
        // Set a timeout...
        setTimeout(function () {
            // Hide the address bar!
            window.scrollTo(0, 1);
        }, 0);
    });
</script>

这工作确定了几台机器,但今天上午在新机器上我遇到了一个弹出页面加载时:

This has worked ok an several machines but this morning on a new machine I encountered an popup when the page loads:

有问题的机器已经安装IE9和我有禁用脚本调试设置经过。

The machine in question has IE9 installed and I have the Disable Script Debugging setting Checked.

什么是解决这一问题的最佳途径。我可以在JS加一些条件在IE中运行时不执行?

What is the best way to tackle this issue. Can I add some condition in the JS to not execute when running in IE?

推荐答案

我知道这个问题是从2012年开始,但有一个答案吧。

I know that this problem is from 2012 but there is an answer for it.

在顶部&LT; HEAD&GT; 其中脚本添加你需要写文档

At the top of the <head> document where script is added you need to write

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

的WinForms WebBrowser控件使用Internet Explorer,但你需要给力的最新版本出现。对于如。如果你正在使用jQuery 2+它需要IE 9,所以你至少需要9或更高版本使用。

WinForms WebBrowser control is using Internet Explorer but you need to force the latest version there. For eg. if you are using jQuery 2+ it requires IE 9+ so you need to use at least version 9 or later.

这篇关于对象不支持属性或方法WebBrowser控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆