我正在尝试在 Chrome 的 background.js
文件中创建数据库和表,但不知何故它没有被创建。当我在 Chrome Inspector > Resources > WebSQL 中查看时,我什么也没找到。代码如下:
function fetchData(){
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://localhost/php/fetch.php", true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
// JSON.parse does not evaluate the attacker's scripts.
var resp = xhr.responseText;
if(resp != null) {
var json = JSON.parse(resp)
console.log(resp);
var data = json['data'];
if(data != null) {
openDatabase('documents', '1.0', 'my storage', 5*1024*1024, function (db) {
alert('Called'); //This is not being called.
});
//var dbConnection = openDbConnect();
//createTable(dbConnection);
//Code below is called
for(var a=0;a <= data.length;a++) {
alert(data[a].title);
}
}
}
}
}
xhr.send();
}
更新
我猜它正在创建:我的扩展 ID 是 bkjajbjnoadlhnhmfekipifehbhgidpg
在 ~/Library/Application Support/Google/Chrome/Default/databases
中我发现:
chrome-extension_bkjajbjnoadlhnhmfekipifehbhgidpg_0
但奇怪的是我在 Inspector 中看不到它。
更新#2
事实证明,与页面一样,WebSQL
在 Chrome 中不可见。它向所访问的页面显示 Db。现在我不知道如何在查看器中多余的 chrome 相关数据库。
最佳答案
关于javascript - Chrome 扩展程序 : WebQL database is not appearing in Inspector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36324096/