Hi,
I have a website which is working good in IE9. But recently I have updated my IE9 to IE10 , then some of the webpages are not working properly.
I found a solution to forcebly render IE10 browser to IE9.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" > like this.
That works fine in local and test environments. But its not working in live environment.
If i open my website in IE, press F12( developer tools), in that browser mode - ie10 and document mode is getting like my solution which is - ie9.
If i change browser mode to IE10 compatibility view, website works fine in all 3 servers(local, test and live). but i can't setup each and everytime for IE10 compatibility view.
Is there any way to change browser mode to IE10 compatibility view through programatically(vb.net)
Thanks in advance. It's little bit urgent, can anyone help on this?
Private Function GetIEBrowserMode() As String
Dim Mode As String = String.Empty
Dim Version As String = String.Empty
Try
Dim UserAgent As String = Request.UserAgent ' Entire UA string
Dim Browser As String = Request.Browser.Type ' Browser Name and Major Version #
If UserAgent.Contains("Trident/6.0") Then
If Browser = "IE7" Then
Mode = "IE10 Compatibility View"
Else
Mode = "IE10 Standard"
End If
ElseIf UserAgent.Contains("Trident/5.0") Then
If Browser = "IE7" Then
Mode = "IE9 Compatibility View"
Else
Mode = "IE9 Standard"
End If
ElseIf UserAgent.Contains("Trident/4.0") Then
If Browser = "IE7" Then
Mode = "IE8 Compatibility View"
Else
Mode = "IE8 Standard"
End If
ElseIf Not UserAgent.Contains("Trident") Then
Mode = Browser
End If
Dim VersionNumber As String() = Mode.Split(New Char() {" "c})
Version = VersionNumber(0)
Catch ex As Exception
' Log error message
Dim LogMessage As String = "There was an error while determining the browser version because " & ex.Message
Logger.Write(LogMessage, Logger.LogCategory.Warranty, TraceEventType.Error, Logger.LogPriority.High)
End Try
' Return the browser version
Return Version
End Function
If GetIEBrowserMode() = "IE10" Then
Dim force As HtmlMeta = New HtmlMeta()
force.HttpEquiv = "X-UA-Compatible"
force.Content = "IE=EmulateIE8"
Page.Header.Controls.AddAt(0, force)
Response.AddHeader(force.HttpEquiv, force.Content)
' Page.ClientTarget = "IE9 Compatibility View"
End If