Home > Development, Mobile > What’s my apps agent string? Well that depends…

What’s my apps agent string? Well that depends…

Hybrid apps (apps that include native content and web content) are becoming more popular by the day. One question that naturally follows development of a hybrid app is “What’s the agent string so I can track it?”

 

Unfortunately there isn’t as simple one line answer to this question because of the way our platform has evolved over time. On the phone, for example, we send manufacturer and model information about the device in use. But beyond hardware we’ve also had an evolution in development platforms. At our //Build conference this year we announced the new Universal App model, which more or less allows you to run Windows 8 apps on your phone. In most cases this supersedes the classic Silverlight model but we still need to let web sites know the environment they’re running in so that they can tailor their experience accordingly.

 

Below is a list of agent strings for our current OS’s and dev platforms as of 5/14/2014. When this changes in the future I’ll try to come back and update this post. I’ve highlighted the changes in the agent strings for each scenario as compared to the “traiditional” mode for that platform. Below the agent strings you’ll find more notes about special cases and I even include bonus information at the end on how to test your site for Windows Phone using only your desktop browser!

 

Windows 8.1

 

IE Traditional (Desktop) Mode

Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko

 

IE in "Modern" Mode

Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; Touch; rv:11.0) like Gecko

 

Universal App WebView (C#)

Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; WebView/2.0; rv:11.0) like Gecko

 

Universal App WebView (JavaScript)

Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; Touch; MSAppHost/2.0; rv:11.0) like Gecko

 

 

Windows Phone 8.1

 

IE in Traditional (Mobile) Mode

Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; <manufacturer>; <model>) like Gecko

 

IE in Desktop Mode

Mozilla/5.0 (Windows NT 6.2; ARM; Trident/7.0; Touch; rv:11.0; WPDesktop; <manufacturer>; <model>) like Gecko

 

Universal App WebView (C#)

Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; WebView/2.0; rv:11.0; IEMobile/11.0; <manufacturer>; <model>) like Gecko

 

Universal App WebView (JavaScript)

Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; MSAppHost/2.0; rv:11.0; IEMobile/11.0; <manufacturer>; <model>) like Gecko

 

Silverlight App WebBrowser

Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; WebBrowser/8.1; IEMobile/11.0; <manufacturer>; <model>) like Gecko

 

 

 

Desktop Mode for IE on Phone

 

IE on Windows Phone has an option to render sites as the desktop version under settings.

 

clip_image001[10]

Many users prefer this mode, especially users with larger screens.

 

 

Universal Apps

 

These are new to Windows Phone 8.1. Going forward, this is the mode that most developers will chose to use. Silverlight is the "classic" model in use today.

 

 

 

C# vs JavaScript

 

It’s interesting to note that there is a difference in agent strings when building an app with C# vs JavaScript. The agent string changes from WebView to MSAppHost. This is due to the fact that in Xaml apps the content is presented in a control that renders HTML whereas in HTML apps it’s just an area with different sandbox rules.

 

 

 

Simulating IE for Windows Phone on the Desktop

IE 11 and 12 on the desktop have the ability to simulate IE for Windows Phone pretty closely. To simulate Windows Phone IE (and use the desktop debugging tools in all their glory):

 

  1. Start IE
  2. Press F12
  3. Scroll down to the last tab in the dark bar on the left (Emulation) and set:
    • Document Mode: 10
    • Browser profile: Windows Phone
    • User Agent String: IE10 – Windows Phone
    • Orientation: Portrait

 

clip_image002[10]

Note: These options will change going forward as IE for phone moves up in version numbers.

 

 

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: