开发者

Changing User Agent

开发者 https://www.devze.com 2023-03-26 13:34 出处:网络
I am trying to change my user agent like this [req setValue:userAgent forHTTPHeaderField:@\"User-Agent\"];

I am trying to change my user agent like this

[req setValue:userAgent forHTTPHeaderField:@"User-Agent"];

Where userAgent is an NSString and it seems to work in the app because when I NSLog it it shows up as what I changed it to

NSLog(@"user agent = %@", [req valueForHTTPHeaderField: @"User-Agent"]);

But when I go to this site http://whatsmyuseragent.com/ the user agent is unchang开发者_StackOverflow中文版ed. Does anyone know why this could be.

Thanks Clinton


If you go to the site with Browser like Safari , the user agent is unchanged . You set the value is just for your Request one time , not for the browser or all the request .

0

精彩评论

暂无评论...
验证码 换一张
取 消