Last active
October 31, 2018 22:28
-
-
Save cdeutsch/6707396 to your computer and use it in GitHub Desktop.
Code to customize the UserAgent in Xamarin.iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there one for WKWebview?