Skip to content

Instantly share code, notes, and snippets.

@cdeutsch
Last active October 31, 2018 22:28
Show Gist options
  • Select an option

  • Save cdeutsch/6707396 to your computer and use it in GitHub Desktop.

Select an option

Save cdeutsch/6707396 to your computer and use it in GitHub Desktop.
Code to customize the UserAgent in Xamarin.iOS
// get useragent
UIWebView agentWebView = new UIWebView ();
var userAgent = agentWebView.EvaluateJavascript ("navigator.userAgent");
agentWebView = null;
userAgent += " XamarinBarcodeSampleApp";
// set default useragent
NSDictionary dictionary = NSDictionary.FromObjectAndKey(NSObject.FromObject(userAgent), NSObject.FromObject("UserAgent"));
NSUserDefaults.StandardUserDefaults.RegisterDefaults(dictionary);
@amrutha786
Copy link
Copy Markdown

Is there one for WKWebview?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment