[WPSL]Get Device user agent on Windows Phone Silverlight 8 App using C# RRS feed

  • Question

  • Hi All,

    I have developed Windows Phone 8 App. and I have used hard code string till now for user agent. Now I want to fetch the device User-Agent on non UI thread.

    Example My App will expected to run on Windows Phone 7.5/8/8.1 and Windows 10 OS devices. 

    Please help me to get the correct User Agent for Particular device and based on particular OS.


    Pallam Madhukar

    Pallam Madhukar Windows Phone Developer

    Wednesday, April 13, 2016 11:18 AM


  • Hi Pallam Madhukar,

    As a friendly reminder please make sure to add the appropriate tags to the title of your post as per Guide to posting: subject line tags

    Based on my mind ,at present there is no way to to fetch the device User-Agent on non UI thread .

    But you could use  a temp WebBrowser control to get user agent, for example:


          public string GetUserAgent()
                string userAgent = "";
                string Html =  @"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN"">
            <script language=""javascript"" type=""text/javascript"">
                function notiUserAgent() {
            <body onload=""notiUserAgent();""></body>
                var tempWebBrowser = new WebBrowser();
                tempWebBrowser.IsScriptEnabled = true;
                tempWebBrowser.Visibility = Visibility.Collapsed;
                tempWebBrowser.Loaded += (sender, args) => tempWebBrowser.NavigateToString(Html);
                tempWebBrowser.ScriptNotify += (sender, args) =>
                    userAgent = args.Value;
                return userAgent;

    Best Regards


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, April 14, 2016 10:44 AM