add a user-agent

Welcome! Forums Unity Plugins In-App Web Browser add a user-agent

This topic contains 3 replies, has 3 voices, and was last updated by  nbrindic 2 days, 20 hours ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1295


    Hi, thank you for your amazing plugin, I would like to add user-agent information in the browser, because on the analytics of my website the in-app navigator is shown as “Unknown” and that’s bother me ^^

    Is there an easy-way to do that and supported on both platforms ?




    I have purchased this plugin and I have to say it works quite well on both iOS and Android.
    But there is just one thing I miss, and it is very important for my app – I have to support “Login with Google”, which requires user agent properly set to some value.

    It is trivial to add in your plugin:


    // get original UserAgent string by using temporal UIWebView
    UIWebView *tmp = [[UIWebView alloc] init];
    NSString *originalUA = [tmp stringByEvaluatingJavaScriptFromString:@”navigator.userAgent”];

    // create custom UserAgent string
    NSString *customUA = [NSString stringWithFormat:@”%@ %@”, @”MY_CUSTOM_USER_AGENT”, originalUA];

    // set custom UserAgent as default
    NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:customUA , @”UserAgent”, nil];
    [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];

    After these lines, you could just expose a configuration field in Unity, and it will work.

    This is pretty important feature for me, and I am willing to help kokosoft with it, so please reach me in order to do this thing.


    Could you create PR for a github repository with this API?
    I could give you an access. Just send me your github username.



    Hey Piotr, it is nbrindic, and my email there is the one I have registered my account on this forum. Btw – does this plugin allow javascript calls?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.