android webView用法

 先讲述一下

webView.loadDataWithBaseURL(url, doc, mimeType, charset, url);

函数原型

void android.webkit.WebView.loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String historyUrl)Parameters:
baseUrl Url to resolve relative paths with, if null defaults to "about:blank"
data A String of data in the given encoding.
mimeType The MIMEType of the data. i.e. text/html. If null, defaults to "text/html"
encoding The encoding of the data. i.e. utf-8, us-ascii
historyUrl URL to use as the history entry. Can be null.

说一下方法遇到的几个问题

1: 如果不写 baseUrl  指定data内的 超链接如果写的是 /开头的uri 的话, 将会无法访问

2:baseUrl  如果写成主机的domain 例如 http://www.google.cn 可以访问 data中的超链接,但是 无法使用 goback

3: 将 baseUrl  与 historyUrl 写成相同的,一切正常

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值