Michael Robinson
Michael Robinson

Reputation: 1439

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

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

Upvotes: 0

Views: 1408

Answers (3)

SoftmasterG
SoftmasterG

Reputation: 79

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.

Upvotes: 0

Ben Gottlieb
Ben Gottlieb

Reputation: 85522

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)

Upvotes: 5

Anurag
Anurag

Reputation: 141859

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

Upvotes: 0

Related Questions