Compatibility setting for webbrowser in GUI

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 6 years and 9 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
User avatar
Abhishek_Paul
Posts: 24
Last visit: Fri Jun 15, 2018 2:04 am

Compatibility setting for webbrowser in GUI

Post by Abhishek_Paul »

Product, version and build: powershell studio 2017 (5.4.139)
(*** Please do not write "latest" as a version, specify a version number ***)
32 or 64 bit version of product:64
Operating system:win10
32 or 64 bit OS:64
PowerShell Version:5

DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
I am creating a GUI which contains "webbrowser " control . I am opening a website inside webbrowser control that displays the following :
Your browser is not supported

Currently the Web Console is only fully supported on Google Chrome, Firefox, and Internet Explorer versions 10 or greater. If you are running Internet Explorer version 10 or greater and you are still seeing this message, your browser's compatibity mode may be enabled for this site.
We suggest using Chrome if possible


when I am opening the same URL I am getting the same error . However when I am going to the setting of internet explorer : Tools -> Compatibility View Setting -> Unchecking bekiw options : Display Intranet sites in compatibility view
With this setting I am able to access the intranet website without any issue .

How can I implement the same setting in Webbrowser object in GUI ? (where is the setting to unchecked "Display Intranet sites in compatibility view" for Webbrowser control?
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Compatibility setting for webbrowser in GUI

Post by davidc »

[TOPIC MOVED TO POWERSHELL GUIS FORUM BY MODERATOR]
David
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Compatibility setting for webbrowser in GUI

Post by davidc »

David
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Compatibility setting for webbrowser in GUI

Post by jvierra »

The web control follows the settings for IE. You can make only subtle changes through the properties of the control. If you set IE to treat all sites in compatibility mode the browser version will be degraded to IE8. Don't force all sites to this mode.

If you are displaying your own content then use the header meta tags from the article linked above to force the web control to switch IE modes.
User avatar
Abhishek_Paul
Posts: 24
Last visit: Fri Jun 15, 2018 2:04 am

Re: Compatibility setting for webbrowser in GUI

Post by Abhishek_Paul »

I just to disable this option : Display Intranet sites in compatibility view in Webbrowser control . I don't need to change the control for all website .

Even if I disable this option in local IE compatibility setting , getting the same error . So, I believe I need to do some change within webbrowser Controls
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Compatibility setting for webbrowser in GUI

Post by jvierra »

The control only supports IE 8. So you will have issues trying to connect to IE10 and later only sites that are not set to force IE10 or later.

What site is the issue? Perhaps the site owner can update the headers to add the meta tags.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Compatibility setting for webbrowser in GUI

Post by jvierra »

Another issue is that full browser use is only available in applications that are "Full Trust" PowerShell is "Partial Trust".
User avatar
Abhishek_Paul
Posts: 24
Last visit: Fri Jun 15, 2018 2:04 am

Re: Compatibility setting for webbrowser in GUI

Post by Abhishek_Paul »

How can I user the webbrowser control to automatically log in. I did google and found out the below code for automatically login in website using IE.
  1. $ie = New-Object -ComObject 'InternetExplorer.Application'
  2. $ie.Visible= $true # Make it visible
  3.  
  4. $username="test@toto.fr"
  5.  
  6. $password="test1"
  7.  
  8. $ie.Navigate("https://To your detailled URL")
  9.  
  10. While ($ie.Busy -eq $true) {Start-Sleep -Seconds 3;}
  11.  
  12. $usernamefield = $ie.document.getElementByID('ysi_email')
  13. $usernamefield.value = "$username"
  14.  
  15. $passwordfield = $ie.document.getElementByID('ysi_password')
  16. $passwordfield.value = "$password"
  17.  
  18. $Link = $ie.document.getElementByID('ysi_btn_login')
  19. $Link.click()
  20.  
  21. $ie.Quit()
I was wondering if I can use this in webbrowser control.
I used the following references:
https://stackoverflow.com/questions/406 ... powershell
https://social.technet.microsoft.com/Fo ... powershell
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Compatibility setting for webbrowser in GUI

Post by jvierra »

Current Google versions do not allow scripted logins.
This topic is 6 years and 9 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