WebBrowser control is not displaying the web page content properly, giving script errors prompt

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 2 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
techie024
Posts: 3
Last visit: Sun Nov 14, 2021 11:47 pm

WebBrowser control is not displaying the web page content properly, giving script errors prompt

Post by techie024 »

Hi,

WebBrowser control of Powershell Studio 2019 is not displaying the web page content properly, giving script errors prompt.
Hence kindly assist here.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: WebBrowser control is not displaying the web page content properly, giving script errors prompt

Post by jvierra »

Sorry but that is not enough information to diagnose you issue.

The WBC is based on IE and defaults to IE10/11. Most web sites no longer support IE and IE cannot display or execute modern ECMAScript on sites that use the new extensions. Also, the security of IE may be restricting some scripting.
techie024
Posts: 3
Last visit: Sun Nov 14, 2021 11:47 pm

Re: WebBrowser control is not displaying the web page content properly, giving script errors prompt

Post by techie024 »

Hi Jvierra,

The website is loading fine, when opening separately in Internet Explorer. however when trying to access the page via webbrowser control, the page content is getting distorted and receiving the prompts for script errors.

Therefore, kindly suggest any solution or workaround for the same, or if any other external control can help here?

Thanks in advance.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: WebBrowser control is not displaying the web page content properly, giving script errors prompt

Post by jvierra »

As I noted, there is no way to know the issue without a full description of what you are trying and how you need to set up the control to work correctly. Remember IE and full browsers automatically detect the web site and negotiate a compatible exchange. The default settings may not allow this.

Without knowing the web site and its requirements then there is no way to guess at what you are seeing. What do you mean by script errors?

I recommend reviewing the documentation for the control including all settings and properties. This will help you to understand the errors and will likely tell you what customizations you need.

Also note that the WBC is NOT IE but it uses the same rendering engine but the rest of the browser is different and also has been restricted by newer Windows security. Basically, no one has really used the WBC for years.

The WBC is not your normal WinForms control. It is extremely complex and the documentation will help you work out if you can actually use it.

Here are the instructions:
https://docs.microsoft.com/en-us/dotnet ... esktop-4.8

Here are the WebBrowser Class docs for propertiess, methods and events.
https://docs.microsoft.com/en-us/dotnet ... esktop-5.0
This topic is 2 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked