26 Eylül 2019 Perşembe

VB.Net Internet Explorer Browser Emulation

Firstly add this code in Form1 class

    Sub SetBrowser()

        Dim Key As String = "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"

        Dim AppName As String = System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".exe"

        Dim Mode As Integer = 9999

        Dim RKey As RegistryKey = Registry.CurrentUser.CreateSubKey(Key)

        If Not CBool(RKey.GetValue(AppName, False)) Then

            RKey.SetValue(AppName, Mode, RegistryValueKind.DWord)

            System.Threading.Thread.Sleep(1000)

        End If

        RKey.Close()

    End Sub
After add this code Form1 Load

SetBrowser()

        'HKEY_CURRENT_USER is recommended if you do not want to run your application with administrative privileges.

        InternetExplorer.SetLatestBrowserEmulation(InternetExplorer.RegistryRoot.HKEY_LOCAL_MACHINE)

        InternetExplorer.SetLatestBrowserEmulation(InternetExplorer.RegistryRoot.HKEY_CURRENT_USER)

Do not forget change option WebBrowser1 ScriptErrorsSuppressed True

Hiç yorum yok:

Yorum Gönder