Results 1 to 4 of 4

Thread: VS2019 Json undefined when using Webbrowser

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2005
    Posts
    37

    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,

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: VS2019 Json undefined when using Webbrowser

    Quote Originally Posted by aboka View Post
    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...

    Quote Originally Posted by aboka View Post
    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2005
    Posts
    37

    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,

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2005
    Posts
    37

    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
  •  



Click Here to Expand Forum to Full Width