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

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,565
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
  • 498,455
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
  • 41
  • 58