Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Site Bugs / Suggestions
  4. unexpected "script" error messages when using WebBrowser control in WinForms to navigate to CP sites

unexpected "script" error messages when using WebBrowser control in WinForms to navigate to CP sites

Scheduled Pinned Locked Moved Site Bugs / Suggestions
csharpquestiondatabasevisual-studiowinforms
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BillWoodruff
    wrote on last edited by
    #1

    VS Version 16.8.6, Win 10, Chrome Version 88.0.4324.182 (Official Build) (64-bit) I was working on a response to a QA question: [^], and I reached in my code closet and pulled out an old example using the WebBrowser:

    private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    {
    string url = @"https://www.codeproject.com";

    if (browserForm == null) throw new NullReferenceException();
    
    if (! browserForm.Visible) browserForm.Show();
    
    browserForm.TheWebBrowser.Navigate(url);
    
    linkLabel1.LinkVisited = true;}
    

    This will trigger navigation to CP in the WebBrowser instance in a Form "owned" by the WinForm "main form." Several script errors will occur before a CP page, not the home page, is shown. Perhaps this is not an error ? An artifact of CP security ? cheers, Bill

    «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

    Richard DeemingR C 2 Replies Last reply
    0
    • B BillWoodruff

      VS Version 16.8.6, Win 10, Chrome Version 88.0.4324.182 (Official Build) (64-bit) I was working on a response to a QA question: [^], and I reached in my code closet and pulled out an old example using the WebBrowser:

      private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
      {
      string url = @"https://www.codeproject.com";

      if (browserForm == null) throw new NullReferenceException();
      
      if (! browserForm.Visible) browserForm.Show();
      
      browserForm.TheWebBrowser.Navigate(url);
      
      linkLabel1.LinkVisited = true;}
      

      This will trigger navigation to CP in the WebBrowser instance in a Form "owned" by the WinForm "main form." Several script errors will occur before a CP page, not the home page, is shown. Perhaps this is not an error ? An artifact of CP security ? cheers, Bill

      «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      I assume you're aware that the WebBrowser control is stuck in IE7 mode by default, unless you modify the registry on every computer where your application runs? Web Browser Control & Specifying the IE Version - Rick Strahl's Web Log[^] I don't think it's unreasonable for modern sites to no longer support IE7 - it hasn't been updated in the last 11 years. :)


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      B 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        I assume you're aware that the WebBrowser control is stuck in IE7 mode by default, unless you modify the registry on every computer where your application runs? Web Browser Control & Specifying the IE Version - Rick Strahl's Web Log[^] I don't think it's unreasonable for modern sites to no longer support IE7 - it hasn't been updated in the last 11 years. :)


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        B Offline
        B Offline
        BillWoodruff
        wrote on last edited by
        #3

        thanks, Richard; fyi: using URL's of some other common sites results in correctly loaded web-pages; however, accessing StackOverflow exhibits similar script errors, and partial page loading where you can see a warning that the site does not accept Internet Explorer, but, does accept Edge, Chrome, etc. MSDN works okay; other sites that load properly come up in Thai probably because they can geo-locate me. i have a hazy memory of some content from MS suggesting the WinForm WebBrowser control has been updated in the last few years.

        «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

        Richard DeemingR 1 Reply Last reply
        0
        • B BillWoodruff

          thanks, Richard; fyi: using URL's of some other common sites results in correctly loaded web-pages; however, accessing StackOverflow exhibits similar script errors, and partial page loading where you can see a warning that the site does not accept Internet Explorer, but, does accept Edge, Chrome, etc. MSDN works okay; other sites that load properly come up in Thai probably because they can geo-locate me. i have a hazy memory of some content from MS suggesting the WinForm WebBrowser control has been updated in the last few years.

          «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #4

          BillWoodruff wrote:

          the WinForm WebBrowser control has been updated in the last few years

          Not that I've seen. Unless you're thinking of the new WebView2 control, which is based on Edge? Microsoft Edge WebView2 Control - Microsoft Edge Development | Microsoft Docs[^]


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          B 1 Reply Last reply
          0
          • Richard DeemingR Richard Deeming

            BillWoodruff wrote:

            the WinForm WebBrowser control has been updated in the last few years

            Not that I've seen. Unless you're thinking of the new WebView2 control, which is based on Edge? Microsoft Edge WebView2 Control - Microsoft Edge Development | Microsoft Docs[^]


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            B Offline
            B Offline
            BillWoodruff
            wrote on last edited by
            #5

            Yes, that's what I am thinking of. As usual, the MS how-to for using it in Visual Studio WinForms omits the dependency on having Edge installed, and omits any mention of a work-around for the common failure [^] to get a non-null value for the CoreWebView2 object of the WebView that contains methods like Navigate. I hope you don't tell Redmond I uninstall Edge !

            «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

            1 Reply Last reply
            0
            • B BillWoodruff

              VS Version 16.8.6, Win 10, Chrome Version 88.0.4324.182 (Official Build) (64-bit) I was working on a response to a QA question: [^], and I reached in my code closet and pulled out an old example using the WebBrowser:

              private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
              {
              string url = @"https://www.codeproject.com";

              if (browserForm == null) throw new NullReferenceException();
              
              if (! browserForm.Visible) browserForm.Show();
              
              browserForm.TheWebBrowser.Navigate(url);
              
              linkLabel1.LinkVisited = true;}
              

              This will trigger navigation to CP in the WebBrowser instance in a Form "owned" by the WinForm "main form." Several script errors will occur before a CP page, not the home page, is shown. Perhaps this is not an error ? An artifact of CP security ? cheers, Bill

              «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

              C Offline
              C Offline
              Chris Maunder
              wrote on last edited by
              #6

              I'm guessing lots of those script errors will be ads, but there are sure to be some jQuery issues since we dropped IE support many, many moons ago. However, the site still works fine on my 2010 iPad!

              cheers Chris Maunder

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups