question

IoannisNtizoglou-4986 avatar image
0 Votes"
IoannisNtizoglou-4986 asked ·

C# Webbrowser project - Keep having javascript errors

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

azure-webapps-authentication
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MonikaNalla-msft avatar image
0 Votes"
MonikaNalla-msft answered ·

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.





· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

IoannisNtizoglou-4986 avatar image
0 Votes"
IoannisNtizoglou-4986 answered ·

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.

· 1 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

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 and meanwhile I will try to replicate this issue as well.

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 Votes 0 · ·
IoannisNtizoglou-4986 avatar image
0 Votes"
IoannisNtizoglou-4986 answered ·

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

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Monalla-MSFT avatar image
0 Votes"
Monalla-MSFT answered ·

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.

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.