0

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

PengOne
  • 47,805
  • 17
  • 129
  • 148
Ray
  • 15,575
  • 5
  • 27
  • 50

2 Answers2

1

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.

PengOne
  • 47,805
  • 17
  • 129
  • 148
  • Here is the in the web page: . So is it XHTML? I tried to download the page to a NSData and called [self.webView loadData:data MIMEType:@"text/html" textEncodingName:@"UTF-8"; but got the same error. – Ray Jun 12 '11 at 13:40
0

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.

karlbecker_com
  • 969
  • 1
  • 10
  • 15