【问题标题】:Chrome Extension: WebQL database is not appearing in InspectorChrome 扩展:WebQL 数据库未出现在 Inspector 中
【发布时间】:2016-03-31 04:20:13
【问题描述】:

我正在尝试在 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。现在我不知道如何在 Viewer 中增加与 chrome 相关的 Db。

【问题讨论】:

    标签: javascript google-chrome google-chrome-extension web-sql


    【解决方案1】:

    要访问应用背景页面的检查器,请转到菜单>设置>扩展,并确保它处于开发人员模式。它应该有一个链接来检查你的应用程序的背景页面。它将在新窗口中打开。

    【讨论】:

      猜你喜欢
      • 2021-01-26
      • 2019-07-31
      • 1970-01-01
      • 2013-03-09
      • 2016-06-13
      • 2013-02-10
      • 1970-01-01
      • 2019-01-06
      • 1970-01-01
      相关资源
      最近更新 更多