5

We are starting to upgrade our laptops to Windows 8 touch screen and we are finding out some of the older websites (Ones we cannot change) detect the touchscreen as a mobile device and will not load the website correctly. We are using IE11 in Desktop Mode.

Is there a way to change what userstrings we are passing to the web servers?

Tyler
  • 394
  • 3
  • 10
  • 24
  • 1
    [This](http://www.howtogeek.com/howto/18450/) might be relevant, although it is for IE8. – Doktoro Reichard Oct 16 '13 at 14:42
  • 2
    Which version of IE11 are you using? The `Modern UI` full touchscreen version or full desktop version? Your options depend on your answer. – Ramhound Oct 16 '13 at 14:43
  • Desktop version – Tyler Oct 16 '13 at 14:47
  • 1
    @Tyler - This means you can use an IE extension to change the user agent. You might also want to try the `compatability view` feature. In the end you might have to use a different browser if an extension cannot be used to change the user agent and the website cannot be changed. – Ramhound Oct 16 '13 at 15:26
  • The problem is the website works with IE only. And now that the new IE is changing it's userstring I think we may really have a problem. Thank you. – Tyler Oct 16 '13 at 15:59

3 Answers3

4

The problem with UAPick from Bayden Systems and also the method of using IE11s own "Development Tools" with F12, Ctrl+8, User Agent String, is that these setting do not survive a restart of IE11.

I did some testing with changing the values in the registry from the links @harrymc already provided.

First changing the HKEY_LOCAL_MACHINE one but that didn't take here.
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent

However changing HKEY_CURRENT_USER worked. (but is user specific)
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent

First the result without changes: (result from myip.nl)
This is for a Windows 8.1 64bit with IE11 v11.0.9600.16384.

User agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko 
Browser: Unknow browser. 

I made a IE9.reg with the following:

REGEDIT4

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent]
@="Mozilla/5.0"
"Compatible"="compatible"
"Platform"="Windows NT 6.1"
"Version"="MSIE 9.0"

This completely changes your "User Agent String". After executing it i got:

User agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko 
Browser: Internet explorer 9.0 

But this would also change your "Platform". I would leave that one out. (You could also leave "Mozilla" on the default.)

Maybe, if your webpages only looks for MSIE, it's sufficient to only change the Version-information. Platform and "Mozilla" can remain untouched so websites can still identify it correctly. I also added the Compatible-tag. Maybe that's also used.

REGEDIT4

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent]
"Compatible"="compatible"
"Version"="MSIE 9.0"

This results in:

User agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko 
Browser: Internet explorer 9.0 

The string given by the Development Tools (F12, Ctrl+8, User Agent String) gives for IE9 is:
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

This seems closest to the original and adds the ability to identify it as IE9 compatible.

I don't know what exactly in your "User Agent String" triggers your websites to 'give' a mobile view (you didn't specify your UA) but playing with these values should fix it and these settings survive a restart of IE11 and the PC.


Edit:
So the problem is the Touch in:
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/7.0; Touch; LCJB; rv:11.0)

IE doesn't give you the possibility to change (or remove) the parts it adds itself. We can change Compatible, Platform, Version and can add Pre and Post Platform tokens. (although Version won't be in send IE11 anymore and Pre and Post Platform won't be send in the header.)

You could try setting the compatibility mode to see it Touch is still there. (Did you try that already ?) If that works you could add the troubled sites to the list so they always display in compatibility mode.

If IE keeps on insisting to send Touch you could try mangling the UA with an extended Platform-key.

REGEDIT4

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent]
@="Mozilla/5.0"
"Platform"="Windows NT 6.1; Trident/7.0; rv:11.0) // ("

This way your UA would be
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/7.0; rv:11.0) // (; Trident/7.0; Touch; LCJB; rv:11.0)
and hopefully the site has more trouble finding Touch between the first ( and ).

If that doesn't work the only option would be a add-on which would override the UA (like UAPick but one which would be permanent after restarts).


Edit #2:

Found another option. If the site scans the whole UA it will find Touch. With the following you mangle the Platform-part of the UA with a linefeed so it will definitely not find it: (I found this solution here)

Make a notouch.vbs-file with the following:

Dim oShell
set oShell = CreateObject("WScript.Shell")
oShell.RegWrite "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Platform", "Windows NT 6.1; Trident/7.0; rv:11.0)" & vbLf & "IGNORE: (", "REG_SZ"
Set oShell = Nothing

(notice the & vbLf & "IGNORE:-part)

After executing the .vbs, the platform-part has a linefeed and after that an IGNORE-line. It will look like this in the headers:

User agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/7.0; rv:11.0)
IGNORE: (Windows NT 6.1; Trident/7.0; Touch; LCJB; rv:11.0)

See... no more Touch in the User agent line ;)
(it's a hack, but hey... it works)

Rik
  • 13,159
  • 1
  • 34
  • 41
  • 1
    You did a good job of verifying that my answer does work. – harrymc Oct 24 '13 at 12:56
  • 1
    @harrymc Yeah, i should have mentioned they where the same, but because you weren't sure it applied to his platform, i thought, lets have a go at it. – Rik Oct 24 '13 at 13:03
  • 1
    Well, after reading your answer I **am** sure, so changed my answer to say it's validated by your experiments. – harrymc Oct 24 '13 at 14:43
  • Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/7.0; Touch; LCJB; rv:11.0) Touch; is what is putting the sites into mobile mode. Any ideas on how to block that? – Tyler May 21 '14 at 15:01
  • @Tyler You asked about changing the "User Agent String". My answer showed how to do that. Does changing it still give you problems (i.e. a mobile site)? If the site react to the word "Touch" then following my answer should remove the word in the User Agent String and the site would stop being "mobile"-styled. – Rik May 21 '14 at 17:03
  • @Rik, correct. Your method does change parts of the string, however Touch; still is passed. Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/7.0; Touch; LCJB; rv:11.0) like Gecko – Tyler May 21 '14 at 17:27
  • @Tyler Aaah, i see. Could you look manually in the registry at `HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent` and possible subkeys (Pre/Post Platform) to see there is any mention of "Touch". Also see [here](http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx). If not also try checking HKEY_LOCAL_MACHINE at the same path for the value. – Rik May 21 '14 at 17:54
  • @Tyler Edit... I think (if nothing is set in the registry) the default values are taken. You can (and did) change the platform, compatibility etc. But what you want to change is the part behind it (Trident...etc.) I'll try to figure out how to overwrite that part. – Rik May 21 '14 at 18:04
  • 1
    @Tyler I added an Edit to the end of my answer. Also... Did you try the Compatibly mode already? (You could add sites to the list for permanent compatibility). Otherwise try the mangling of the UA with the Platform-key as described in my edit. – Rik May 21 '14 at 20:04
  • @Tyler I added a second Edit (#2). This involves adding a line-feed in the platform-part. This way everything behind it will end up on a second (IGNIORE:)-line. This should work for you. With testing here i could change everything in the User Agent. Hope it helps you... – Rik May 22 '14 at 08:12
2

Are you sure that it's the user-agent string that is causing the problem ?

If you are not sure, you can use Fiddler2 to trace and capture the URL request together with all its headers, and you can also experiment in the Composer with crafting modifications to that URL request to see how this affect the website.

The Microsoft article Understanding user-agent strings in the section User-agent registry keys says that certain parts of the user agent string can be modified in IE11 via the registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent as follows :

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
SOFTWARE
  Microsoft
     Windows
        CurrentVersion
           Internet Settings
              5.0
                 User Agent
                    (default) = "Mozilla/4.0"
                    Compatible = "compatible"
                    Platform = "Windows NT 5.1"
                    Version = "MSIE 6.0"
                    Pre Platform
                       Token = Value
                    Post Platform
                       Token = Value

The article says :

The default value of the User Agent key replaces the application name and application version tokens reported in the user-agent string. Be aware that the first seven characters are used for the application name, and the remaining characters specify the application version token.

The Compatible, Platform, and Version values replace the corresponding tokens in the user-agent string.

Additional tokens can be added to the user-agent string by using the Registry Editor to create new string values under the Pre-Platform key or Post-Platform key. The value name should be the complete token; the value data is ignored. Tokens added to the Pre-Platform key appear before the platform token in the final user-agent string. Tokens added to the Post-Platform key appear after the platform token in the final user-agent string. Multiple tokens in either the Pre-Platform key or Post-Platform key are displayed in an unpredictable order.

Some experimentation by @Rik has shown that the above should work for your platform. You can experiment changing these values to disguise your browser to see if this changes that website's behavior.

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • Yes, as emulating IE9 or using USPick to set as IE9 fixes the issue until IE restarts again. Basically, it is the "touch" UA fragment that is causing the site to be served in "mobile mode". – Tyler Oct 23 '13 at 21:43
  • @Tyler: This fix keeps on working even if IE restarts again because it's in the registry. – harrymc Oct 24 '13 at 14:45
  • More possibilities: (1) Try [this method](http://www.door2windows.com/how-to-change-internet-explorer-user-agent-string-in-all-versions-of-internet-explorer-without-any-tool/) using the Local Policy Editor. (2) You could try the free [UAPick](http://www.enhanceie.com/ietoys/uapick.asp). Caveat: Only works in desktop mode and requires Enhanced Protected Mode to be disabled. – harrymc Oct 25 '13 at 17:23
  • Method 2 is already mentioned in the comments (and my answer) and does not survive a restart of IE11. (It works just like the Development Tool (F12) which also does not survive a restart.) Method 1 is interesting. You could add "MSIE 9.0" to your normal User Agent String (at the end). If the site just tests for the presence of `MSIE` in the string, perhaps it will serve you the correct site. This needs to be tested with the sites for which this question was asked. – Rik Oct 25 '13 at 19:13
  • @Rik: Apologies on missing your mention of UAPick. For the Local Policy Editor method, I'm waiting on a word from the poster whether to add it to my answer. – harrymc Oct 25 '13 at 20:53
1

I guess you mean Windows 8.1.
If that's the case, MS changed user agent string for IE11 in Windows 8.1 and it makes old websites detect the PC as mobile device, even for my non-touchscreen laptop. There is a solution, actually a workaround to say. Get chrome/FF and install a user agent switcher addon. Then "FAKE" some old browser(My peronal recommendation IE8) to load up old websites.

That may not be the best way but I am sure its the easiest.

tumchaaditya
  • 3,752
  • 5
  • 39
  • 57
  • 1
    Just to add my $0.02's: Yes, this works with a lot of sites. But it depends on the site claiming "I work only with IE" with which they mean "I also work with other browsers, but I am only tested with IE and if you show my any other name then I will just claim not to work". – Hennes Oct 25 '13 at 17:25
  • 1
    Which seems to be the case here because the site redirects to mobile version... Since updating to Windows 8.1, I have been experiencing this behavior with otherwise well behaving websites as well.. – tumchaaditya Oct 25 '13 at 17:41