开发者

how do i tell a website that it's a UIwebview so it can use css to redraw view

开发者 https://www.devze.com 2022-12-15 06:04 出处:网络
I have a UIwebview that I want to go to Amazon.com, when I load amazon.com it doesn\'t have the same format as if I went there from iphone safari. What tell a website like amamzon to redraw for iphone

I have a UIwebview that I want to go to Amazon.com, when I load amazon.com it doesn't have the same format as if I went there from iphone safari. What tell a website like amamzon to redraw for iphone? Here's my Code:

 - (void)viewDidLoad {

NSString *urlAddress = @"http://www.amazon.com/Inventive-Gadgets-Inc-PQFan-Professionally/dp/B000V8ASR6";

//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];

//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

//Load the request in the UIWebView.
[webView loadRequest:requestObj];
 }

- (IBAction) gotofourth{
[self dismis开发者_JS百科sModalViewControllerAnimated:YES];
}

Any help would be great.

Thanks


You're going to want to change your user-agent; here's an existing question that might help: Change User Agent in UIWebView (iPhone SDK)


The only way for Amazon to tell the difference would be through request HTTP headers. I am guessing a different User Agent is passed when accessing Amazon through UIWebView vs Mobile Safari if anyone can confirm that. Either that or some other header :)


This is the user agent string sent from a UIWebView on an iPad:

appname/1.0+CFNetwork/467.12+Darwin/10.0.0

where appname = the name of the app the UIWebView is running in.

0

精彩评论

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