C# Webbrowser project - Keep having javascript errors

Ioannis Ntizoglou 1 Reputation point
2019-12-10T22:48:27.557+00:00

C# Webbrowser project - Keep having javascript errors.
Can someone please help?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,876 questions
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. Ioannis Ntizoglou 6 Reputation points
    2022-08-22T18:43:50.003+00:00

    2 years since I asked you to fix the issue. Now you have the new Visual Studio 2022. The default web browser still doesn't work. WordPress websites are taking over the internet world and your default web browser isn't capable to load any WordPress websites without braking them (How can you be proud of your product? “Visual Studio 2022”. Should we wait for the version 2060?).
    Why is too difficult to have your developers fix this issue?
    I'm not talking about any other component of Visual Studio.
    I'm talking about the 'Web Browser' tool. I have tried on a VB and C# project and the same issue is there (WordPress websites brake).
    When I add the 'Web Browser' component from the 'Tools' menu and add a url which is WordPress or any url which uses JS, the website brakes, and the 'Web Browser’ component gives me a lot of errors.
    I love Visual studio and my students too however if this will not be fixed soon, I will have no choice but to stop using and delivering sessions by using visual studio.
    Please do something asap.

    1 person found this answer helpful.

  2. Monika Nalla 1 Reputation point
    2019-12-11T02:45:02.697+00:00

    Hello,
    Thanks for using Microsoft Q&A and thanks for reaching out to us.

    Have you tried the below solution. If not, try it and see if it helps.

    • When you press "F5" in VS to debug your app, it runs Project.vshost.exe as the process name. If you run the same app from the command line, it will show up as Project.exe, and the JavaScript errors will go away.
    • Seems like IE sees the app running visa via VSHOST and decides this is fishy and disables JavaScript from loading correctly.
    • So go to your project setting for your executable. Select "Debug" options. Select "Start External Program". Browse to and select Debug\YourProgram.exe (NOT YourProgram.vshost.exe). Save, recompile, and hit F5.
    • Everything should work as per usual now, and Visual Studio even attaches to the process for you automatically.

    Or
    you can try using ScriptErrorSuppressed to get rid of those errors.

    webBrowser1.ScriptErrorsSuppressed = true;

    Also Please go through this blog post for more reference :

    1. Web Browser Issue
    2. Web Browser Issue in c#
    3. JavaScript Code Doesn't work on c# Web Browser

    I hope this information helps.

    Please feel free to reach back if you have any further questions regarding this matter.


  3. Ioannis Ntizoglou 1 Reputation point
    2019-12-11T17:53:13.027+00:00

    Hi Monika,
    I tried all the solutions you have sent me but still, the error doesn't go away.
    The pages I’m trying to open with the VS C# webbrowser project and keep having issues are opening without any issues on all published webbrosers (Chrome, IE, Edge, Firefox, Safari, Opera)
    I managed to bypass the issue by installing NuGet 'EO.WebBrowser' plugin but it is asking for £1000 for this plugin.
    I'm a teacher and I'm trying to fix this issue and produce a video tutorial to ensure that my students will not have the same issue.
    if 'EO.WebBrowser' can create a webbrowser which doesn't give javascript issues, I'm sure Microsoft will be able to do it.
    Can you please report this to the VS team so they can look into this and apply a quick fix/update on the VS 2019?
    I have been trying for the last 3 days to find a solution which doesn't cost money, but I can't. Many other people too.
    I hope you understand my frustration.
    Thanks again for your time.
    Looking forward to hearing from you.


  4. Ioannis Ntizoglou 1 Reputation point
    2019-12-11T18:05:46.073+00:00

    Please try to create a new C# project, with just a webbrowser, then add on the url the following link:
    https://www.123-reg.co.uk/
    You will be able to see the error.
    I will send you more urls if you wish but if this is fixed, the others will be fixed as the issue is the same.
    Looking forward to you reply.
    Thanks

    0 comments No comments

  5. Monalla-MSFT 11,636 Reputation points
    2020-06-04T15:16:06.87+00:00

    Hello Loannis,

    I am so sorry to hear that you are still having this issue. I will try to reach out to the Product Team.

    Please send us an email at AzCommunity@Microsoft.com so we can work offline and post any findings that we may find in the thread here.

    Subject : ATTN:Monika

    I hope to hear back from you soon.

    Thanks again for reaching out to us.

    0 comments No comments