none
Please help, "System.Windows.Forms.WebBrowser" directives IE version is not working in UserControl ? RRS feed

  • Question

  • Hi:

      I spent 3 days in this problem.
    I write a VSTO add-in for PowerPoint 2013 (above).
    Use "System.Windows.Forms.WebBrowser" to navigate my web page in Task Panes.

    namespace Ppt01
    {
        public partial class ThisAddIn
        {
            private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {
                var myUserControl1 = new MyUserControl();
                var myCustomTaskPane = this.CustomTaskPanes.Add(myUserControl1, "My Task Pane");
                myCustomTaskPane.Visible = true;
            }
    
            // ...
    
        }
    }
    namespace Ppt01
    {
        public partial class MyUserControl : UserControl
        {
            public MyUserControl()
            {
                InitializeComponent();
    
                webBrowser1.Navigate( "http://127.0.0.1:8080/site/login.do" );
            }
        }
    }

    My web page (jsp page) has a tag (from tag lib) running JavaScript code; it must use supported HTML5 browser.

    var left = $('div.'+element_id+ '> #page_combobox_table').position().left+'px';

    ( "position()" undefined )

    And I add the HTML code on my page, to tell the "WebBrowser" using above IE 8 version.

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    ...
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    ...

    But, I try it again and again, result:

    1. Windows 10
      (1) PowerPoint 2013 / 2016 always not working.
      (2) A new Windows Form project with "WebBrowser" is working!
      (3) All browser on my computer: "Chrome", "Edge", "IE11", "IE11 emulate IE10, 9, 8" is working and no error in "F12".
    2. Windows 7 + PowerPoint 2016 is just working!

    I'm very wondering:

    • Why the same "WebBrowser" Control (on my computer) in Windows Form is working?
    • Why all browser on my computer is working but PowerPoint Task Panes not?
    • Why PowerPoint on Windws 7 the "WebBrowser" browse the page it's working?
    • I create a new Windows 10 VM.  On this Windows 10, PowerPoint use "WebBrowser" also not working.

    It's Windows 10 fault ?

    Friday, October 27, 2017 7:15 AM

All replies

  • Hello,

    What error do you get when it doesn't work?  

    What html and js code should I use in web application to reproduce the issue?

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, October 30, 2017 6:59 AM
    Moderator
  • Hello,

    What error do you get when it doesn't work?  

    What html and js code should I use in web application to reproduce the issue?

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thanks your reply very much.

    (1) Below it's the error message:
    Line:88, Error: 'left' attribute is undefined or Null.
    Because I use zh-tw system.., I directly posted the code of error position.., what I traced/found result.

    (2) The exception code position is very deep, and it's the tag generated code (HTML/JavaScript); I can't post it all and well recently. (Need sort out..)  Excuse me..

    Tuesday, October 31, 2017 1:55 AM
  • Hello,

    The following html works fine for me in Win10/Office2016 or a winform application. Please test if it works for you. I suggest you narrow down your issue and share repro code here.

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <!--<meta charset="utf-8" />-->
        <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
        <title></title>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
        <script>
            $(document).ready(function () {
                $("button").click(function () {
                    var x = $("p").position();
                    alert("Top position: " + x.top + " Left position: " + x.left);
                });
            });
        </script>
    </head>
    <body>
        <p>This is a paragraph.</p>
        <button>Return the top and left position of the p element</button>
    </body>
    </html>


    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, October 31, 2017 6:51 AM
    Moderator
  • Well.., before I trace the code for posting, I insert the code for test:

    var left = $('div.'+element_id+ '> #page_combobox_table').position().left+'px';
    alert( left );  // Inserted.

    "left" exactly has a number.
    But the submit is invalidly, user click the count of each list view.

    So.., I set:

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

    on my web page; it's work.

    But I don't know, why WebBrowser in VSTO (UserControl) is just not work... (Even it's normal on Win7(sp1), and no matter Office 2013 or 2016.)

    Maybe I need to trace the submit js code.

    Thanks for your patient. :)

    Friday, November 10, 2017 7:58 AM
  • Hello,

    Do you test the code I shared above? Does it work for you on Win10?

    If the code doesn't work for you, the issue might cause from your machine. You may try to install all Windows and Office updates.

    If the code above works fine but your JS file fails, please debug the code to narrow down the issue. We could discuss together if you could share repro code here.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, November 10, 2017 9:52 AM
    Moderator