我使用HTML SQLite在chorme下完全正常,但是放到android的webview里面就没有反应了,是不是android还需要什么特别的设置呢,或者是什么权限没有打开呢,
<uses-permission android:name="android.permission.INTERNET" />我是有加的
这是我的html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="width=device-width, initial-scale=1,user-scalable=no" name="viewport" />
<title>HTML5 Sqlite</title>
<style>
.addDiv {
border: 2px dashed #ccc;
width: 100%;
text-align: center;
}
th {
font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
border-top: 1px solid #C1DAD7;
letter-spacing: 2px;
text-transform: uppercase;
text-align: left;
padding: 6px 6px 6px 12px;
}
td {
border-right: 1px solid #C9DAD7;
border-bottom: 1px solid #C9DAD7;
background: #fff;
padding: 6px 6px 6px 12px;
color: #4f6b72;
word-break: break-all;
word-wrap: break-word;
}
</style>
<script type="text/javascript">
try {
//打开数据库
var db = openDatabase('contactdb', '', 'local database demo', 204800);
//保存数据
function save() {
var userName = document.getElementById("user_name").value;
var mobilephone = document.getElementById("mobilephone").value;
//var company = document.getElementById("company").value;
//创建时间
var time = new Date().getTime();
db.transaction(function (tx) {
tx.executeSql('insert into contact values(?,?,?,?)', [userName, mobilephone, '', time], onSuccess, onError);
});
}
//sql语句执行成功后执行的回调函数
function onSuccess(tx, rs) {
alert("操作成功");
loadAll();
}
//sql语句执行失败后执行的回调函数