1 楼
tracy061
2012-08-01
loadData:
public void loadData (String data, String mimeType, String encoding)
Load the given data into the WebView. This will load the data into WebView using the data: scheme. Content loaded through this mechanism does not have the ability to load content from the network.
Parameters
data A String of data in the given encoding. The date must be URI-escaped -- '#', '%', '\', '?' should be replaced by %23, %25, %27, %3f respectively.
mimeType The MIMEType of the data. i.e. text/html, image/jpeg
encoding The encoding of the data. i.e. utf-8, base64
下如API中所说的,
data:是要加载的数据类型,但在数据里面不能出现英文字符:'#', '%', '\' , '?' 这四个字符,如果有的话可以用 %23, %25, %27, %3f,这些字符来替换,在平时测试时,你的数据时,你的数据里含有这些字符,但不会出问题,当出问题时,你可以替换下。
%,会报找不到页面错误,页面全是乱码。乱码样式见符件。
#,会让你的goBack失效,但canGoBAck是可以使用的。于是就会产生返回按钮生效,但不能返回的情况。
\ 和? 我在转换时,会报错,因为它会把\当作转义符来使用,如果用两级转义,也不生效,我是对它无语了。
以上转自:http://bbs.chinaunix.net/thread-3617508-1-1.html
因为%在loadData中是非法字符。
希望对您有用