为什么我的网页视图会抱怨错误?

时间:2011-07-29 00:04:42

标签: ios uiwebview

我的iPad应用中存在UIWebView问题。当我尝试加载某些页面时,它会显示这些神秘的错误消息。这是http://allhiphop.com/stories/news/archive/2009/04/02/21315001.aspx

的结果
This page contains the following errors:

error on line 45 at column 8: Opening and ending tag mismatch: meta line 0 and head

Below is a rendering of the page up to the first error.

...(blah blah blah)

我确信AllHipHop上的人犯了一些严重的语法罪行,但令我困惑的部分是这些页面在Safari(在iPad上)显示得很好。知道这里发生了什么吗?像webView.allowWhining = NO?

之类的东西

2 个答案:

答案 0 :(得分:1)

事实证明,AllHipHop以不同于Safari的方式处理我的应用程序的请求。 UIWebView具有与iPad Safari不同的用户代理。去图!

设置用户代理解决了我的问题。 Change User Agent in UIWebView (iPhone SDK) What is the iPad user agent?

答案 1 :(得分:0)

这似乎是this question

的重复

基本上,当您在UIWebView中加载内容时,需要将MIME类型指定为“text / HTML”。

相关问题