v 2.0 and browser user agent

Welcome! Forums Unity Plugins In-App Web Browser v 2.0 and browser user agent

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1739
    Alexander
    Participant

    Version v.2.0 is provided without source code.
    Is there a way to set custom browser user agent for iOS?
    I need it to allow Google auth, which does not work with in-app browser native user agent header.

    Old code:
    – (void)startLoadingWebView {
    //set cutom user agent
    NSString *customUA = @”Mozilla/5.0 (iPod; CPU iPhone OS 12_0 like macOS) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/12.0 Mobile/14A5335d Safari/602.1.50; Unity Mobile”;
    NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:customUA , @”UserAgent”, nil];
    [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];

    Thanks!

    #1740
    Alexander
    Participant

    Solved.
    Piotr, I just put the code piece to my own plugin and call it right before opening in-app browser.
    Thanks for the great plugin!

    #1743
    PiotrPiotr
    Keymaster

    Glad you could solve it by yourself 🙂

    I guess I should add API for adding user agent, will try to add this once I’m free with other stuff.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.