-
Oct 12th, 2020, 07:43 AM
#1
Thread Starter
Member
VS2019 Json undefined when using Webbrowser
hi, im on Windows 7 64 Home, and hv IE11 64bit installed. When i manually use IE to browse to the website, all seems ok, but when i try to use VS2019 VB.Net Webbrowser to browse to the website, im getting the 2 'errors' below everytime and the site will not work even after pressing 'ok'. I suspect Webbrowser is using 'compatibility' mode(IE8 or something from some web search).
1) An error has occured in the script on this page
Error: 'JSON' is undefined
2) Security warning
Do you only want to view the webpage content that was delivered securely?
I put this on Form load - MessageBox.Show(WebBrowser1.Version.ToString) and it show it is using 11.0.9600
I just add a new VB.Net Windows project, add Webbrowser1 and use a Button to execute it-
WebBrowser1.Navigate("https://www1.gtr368.com/")
Hv add this to registry but still the same:
[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/json]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00
[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/x-json]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00
[HKEY_CLASSES_ROOT\MIME\Database\Content Type\text/json]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00
Thank you,
-
Oct 12th, 2020, 08:12 AM
#2
Re: VS2019 Json undefined when using Webbrowser
Originally Posted by aboka
I suspect Webbrowser is using 'compatibility' mode(IE8 or something from some web search).
You're correct, although it's IE7... but you're on the right track there...
Originally Posted by aboka
I put this on Form load - MessageBox.Show(WebBrowser1.Version.ToString) and it show it is using 11.0.9600
The version is irrelevant... the compatibility setting is what matters. There's a registry setting you can change that will affect that. Search the forums for "web browser registry compatibility setting" there's a couple threads about this, and one that has the key & values that need to be set.
-tg
-
Oct 12th, 2020, 08:53 AM
#3
Thread Starter
Member
Re: VS2019 Json undefined when using Webbrowser
@techgnome are you talking about the '10001'? i tried that too before posting but forget to include it in the initial post. anyway, i try again one more time following this - https://www.vbforums.com/showthread....rowser-Control
I add a Class to the project, and WebBrowserHelper.FixBrowserVersion() in the Form Load. But get the same errors.
I have use VB6 previously with code similar to below, but it is not working anymore on VS2019
Dim Browser
Set Browser = CreateObject("InternetExplorer.Application")
Browser.navigate "https://www.google.com/"
Please advice if Webbrowser is the best option if i like it to automate fill a form and submit
Thank you,
-
Oct 12th, 2020, 09:20 AM
#4
Thread Starter
Member
Re: VS2019 Json undefined when using Webbrowser
@techgnome i try the second code in that same page manually since i dont know howto declare the code below -
Using Key As RegistryKey = Registry.CurrentUser.CreateSubKey("SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", RegistryKeyPermissionCheck.ReadWriteSubTree)
If Key.GetValue(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".exe") Is Nothing Then
Key.SetValue(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".exe", RegVal, RegistryValueKind.DWord)
End If
End Using
The initial 2 errors is gone now, but it got another error after login in -
An error has occurred in the script on this page
Unable to set property of 'innerHTML' of undefined or null reference
Any suggestion? Thank you.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|