0

I use Remote Desktop to access a Windows 8 PC.

In my MVC 4 controller, I've got this code on the first request:

If Request.Browser.Browser.ToLower = "ie" Then
    If CDec(Request.Browser.Version.Replace(".", ",")) < 9 Then
        Response.Redirect("browser_too_old.html", True)
        Exit Function
    End If
End If

But when I use Remote Desktop to log on to my Windows 8 PC, Internet Explorer defaults to version 7 (Compatibility View):

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/6.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; InfoPath.3)

Since I'm using controller (no webpage has yet been loaded), I can't use this:

meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"

How do I force it to be IE10 (that is - not Compatibility View)?

Peter O.
  • 28,965
  • 14
  • 72
  • 87
MojoDK
  • 4,111
  • 8
  • 37
  • 71
  • Add doctype. Also, on the first request, all bets are off (because you still haven't transmitted any headers/content yet). – Alxandr Jul 03 '13 at 13:46
  • And if you send the actual HTTP header rather than using a meta element? – Mr Lister Jul 03 '13 at 13:46
  • 2
    Just a sidenote, but "forceful upgrading" is a quite agressive counterpart of "progressive enhancement". – CodeCaster Jul 03 '13 at 13:46
  • @CodeCaster Meh. Google doesn't support IE8 anymore, also Microsoft's own "Microsoft Downloads" doesn't work in IE8, so yeah... – Alxandr Jul 03 '13 at 13:48
  • @Alexander not supporting is not the same as blatantly refusing access and besides that, there are better ways to detect browser capabilities than through user-agent sniffing. Anyway not my project, just a helpful remark, OP can choose to do whatever he wishes. – CodeCaster Jul 03 '13 at 13:53
  • @Alexander - but I'm in the controller (first request from the user), no page has yet been rendered, so I can't use doctype. – MojoDK Jul 03 '13 at 13:57
  • @CodeCaster - jquery 2.0 doesn't support IE < 9, so we want to force our clients to update or use another browser. – MojoDK Jul 03 '13 at 13:59
  • 1
    IE defaults to display local/intranet sites in compatibility mode. "You can change these settings from ‘Tools -> Compatibility view settings’ from the IE menu. Of course that menu is now sneakily hidden, so you won't see it until you press Alt." Source: http://stackoverflow.com/questions/3726357/why-does-ie9-switch-to-compatibility-mode-on-my-website – philreed Jul 03 '13 at 14:23
  • And I think it's a mistake to not care for IE8 at this point. There are still many people out there who are not willing to upgrade from Windows XP (and after experiencing Windows Vista, I don't really blame them). Do we really want to alienate all of them? – Mr Lister Jul 03 '13 at 18:17
  • @philreed ... thanks - that did the trick. Post it as an answer and I mark it answered. :) – MojoDK Jul 03 '13 at 20:12
  • @Mr. Lister - Well in a few months, we're using IE11, so I see no problem than telling my customers, that if they want to use my website ... upgrade. The faster everybody does that, the faster people upgrades their browsers. – MojoDK Jul 03 '13 at 20:15

1 Answers1

1

IE defaults to display local/intranet sites in compatibility mode.

"You can change these settings from ‘Tools -> Compatibility view settings’ from the IE menu. Of course that menu is now sneakily hidden, so you won't see it until you press Alt."

Source: Why does IE9 switch to compatibility mode on my website?

Community
  • 1
  • 1
philreed
  • 2,141
  • 2
  • 23
  • 51