Created
December 17, 2013 10:51
-
-
Save hiroshido/8003086 to your computer and use it in GitHub Desktop.
Webviewのnavigator.userAgentを独自のユーザーエージェントにする方法と、その他諸注意(Googel Analytics etc..) ref: http://qiita.com/unamu/items/078ca02c0e3444247ac4
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
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero]; | |
NSString *userAgent = [webView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"]; | |
NSString *customUserAgent = [userAgent stringByAppendingString:@" HOGEHOGE"]; |
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
NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:customUserAgent , @"UserAgent", nil]; | |
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment