views:

454

answers:

3

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 dismissModalViewControllerAnimated:YES];
}

Any help would be great.

Thanks

A: 

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 :)

Anurag
+3  A: 

You're going to want to change your user-agent; here's an existing question that might help: http://stackoverflow.com/questions/478387/change-user-agent-in-uiwebview-iphone-sdk

Ben Gottlieb
A: 

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

appname/1.0+CFNetwork/467.12+Darwin/10.0.0

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

SoftmasterG