Object doesn't support property or method WebBrowser Control

前端 未结 3 1150
轮回少年
轮回少年 2020-12-16 15:44

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 t

相关标签:
3条回答
  • 2020-12-16 16:17

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

    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 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.

    0 讨论(0)
  • 2020-12-16 16:23

    The Webbrowser control is a part of the Internet Explorer itself. And Internet Explorer doesnt support the window.addEventListener method. Use window.attachEvent method instead.

    So the script in your page will read like

    window.attachEvent("load", function () {
        // Set a timeout...
        setTimeout(function () {
            // Hide the address bar!
            window.scrollTo(0, 1);
        }, 0);
    });
    

    Hope this would help you!

    0 讨论(0)
  • 2020-12-16 16:26

    Webbrowser control doesn't suppert jquery v2.

    Use the jquery 1.9.1.

    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    
    0 讨论(0)
提交回复
热议问题