Ray
Ray

Reputation: 16235

iPhone UIWebView problem

I am trying to write an application to show a web page in a web view for this link: http://just4u.safeway.com But the page can not be shown in the UiWebView, I got a message:

This page contains the following errors: error on line 90 at column 11: AttValue: " or ' expected.

Can someone let me know what could be the problem? I already added code to handle redirect, but still get the same problem.

Thanks

Upvotes: 0

Views: 1074

Answers (2)

karlbecker_com
karlbecker_com

Reputation: 959

I was running into a very similar problem. I was using the loadRequest method of UIWebView, which was causing the UIWebView to interpret it as XHTML. I instead used NSURLConnection to asynchronously load the data for the webpage, then used

[webView loadData:downloadedData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:pageURLString]];

and got the page to display without the pink error box at the top.

This is essentially the same solution as PengOne suggests - I just wanted to confirm that the suggestion works fine, and show the sample code that worked for me.

Upvotes: 0

PengOne
PengOne

Reputation: 48398

Try explicitly setting the MIME type of the page to be "text/html". Otherwise it may be parsed in the UIWebview as xhtml. Also check that your <!DOCTYPE> is not claiming to be xhtml.

Upvotes: 1

Related Questions