WebView 工作记录

为移动设备而改造网页

http://newhtml.net/modify-page-for-mobile/

http://www.html5rocks.com/en/mobile/mobifying/

======================

关于link .css或.js

在pc上第二次请求服务器会返回304

在webview跟本不会发起第二次请求。直接会读取缓存。


Tool to see android database, tables and data

http://stackoverflow.com/questions/2149438/tool-to-see-android-database-tables-and-data

There is a tool (sqlite3) installed on the phone itself. You should be able to do this if you have ADB installed on your machine & your phone is connected or currently being emulated.

Find the database files:

adb shell find /data -name *.db
/data/data/com.google.android.apps.maps/databases/search_history.db
/data/data/com.qo.android.htc/databases/webview.db
/data/data/com.qo.android.htc/databases/webviewCache.db
/data/data/com.layar/databases/layar.db
或者select your database (Into Androd --> File Explorer ),You will get an option as "pull a file from device", click on it. 

Open a database using the sqlite tool:

C:\> adb shell 
# sqlite3 /data/data/com.google.android.youtube/databases/history.db

SQLite version 3.5.9
Enter ".help" for instructions
sqlite> .tables
android_metadata  suggestions

sqlite> .schema suggestions
CREATE TABLE suggestions (_id INTEGER PRIMARY KEY,display1 TEXT UNIQUE ON CONFLICT REPLACE,display2 TEXT,query TEXT,date LONG);

sqlite> select * from suggestions;
2|randy pausch last lecture|Results for "randy pausch last lecture"|randy pausch last lecture|1264159994987


或者sqlite database browser could also be helpful, though you need to pull a copy of the database from the device as explained before and work on that copy that can be restored later on.


在android 4.0 webview 使用loadData 会出现中文乱码, 这个时候要使用loadDataWithBaseURL方法

//loadData(html, "text/html", "UTF-8");
loadDataWithBaseURL(null, html, "text/html", "UTF-8", null);



注意的问题:

android 4.0的特殊性---参数

<img src="images/laba.png">
<img src="images/laba.png?v=2">

当加载本地页面(如放在assets下面),在4.0的webview 上第二张图片不能显示,加载本地文件不能带参数

android 4.0的特殊性---特殊符号

4.0对于页面里的特殊符号,可能也会导致无法解析,使js方法不能执行完成。



js方法里的换行

webview对于js方法里的换行无法解析!



ios的uiwebview,meta里用逗号,而不能用分号

<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />


android 2.2的特殊性---window.demo.fun()

android客户端方法String fun();

js调用,返回的是Object类型,而不是String,这个问题出现的android2.2(2.3及以上是ok的)的机型上。

解决办法:window.demo.fun() + ""

s




s



s

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值