- (void)modifyUserAgent {
//修改UA为统一UA
NSString *oldAgent = [self stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];
NSLog(@"old agent :%@", oldAgent);
//add my info to the new agent
NSString*newAgent = [QMParamsHelper commonUserAgent:oldAgent];
NSLog(@"new agent :%@", newAgent);
MEMORY_VALUE.userAgent= newAgent;
//regist the new agent
NSDictionary *dictionnary = [[NSDictionary alloc] initWithObjectsAndKeys:newAgent, @"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionnary];
}
网友评论