UIWebView Xhmtl parse error but safari don't

2020-04-19 06:20发布

I have an application showing standard html pages. I use UIWebView for html. When using safari for pages no problem. When I use uiwebview the page does not load.

Error message(UIWebView)

This page contains the following errors:
error on line 230 at column 33: AttValue: " or ' expected

Below is rendering of the page up to the first error

Different page different xhtml error.


I realased that ipad simulator load page properly too.

1条回答
倾城 Initia
2楼-- · 2020-04-19 06:55

I had a similar issue. I resolved it by explicitly setting the MIME type of the page to be "text/html". Otherwise it was being parsed in the UIWebview as xhtml.

eg in ASP.NET in your masterpage set

<% Response.ContentType = "text/html"; %>

Also check your <!DOCTYPE> isn't claiming to be xhtml.

查看更多
登录 后发表回答