【问题标题】:Is there a way to ask for access to local storage on a computer in HTML?有没有办法以 HTML 格式请求访问计算机上的本地存储?
【发布时间】:2020-09-04 05:56:18
【问题描述】:

我正在尝试将 Google Chrome 应用程序转换为 Web 应用程序。除了遇到一个问题,我已经制作了所有的网络应用程序。在它说的代码中,

`chrome.system.storage.getInfo(function(info){

  console.log(info);
  if(info[0].name == "MICROBIT" && info[0].type == "removable"){
    document.getElementById("bit?").innerHTML= "  YES!";
    document.getElementById("bit?").style.color = "green";
  }
  else{
    document.getElementById("bit?").innerHTML= "  NOPE!";
    document.getElementById("bit?").style.color = "red";
  }
});`

除非您在浏览器中,否则这不起作用,因为您无权访问“chrome.system.storage”。有没有办法访问它?

谢谢

【问题讨论】:

    标签: javascript html css google-chrome web-applications


    【解决方案1】:

    该 API 仅适用于扩展程序。如果需要存储,请改用 localStorage 或 sessionStorage。

    【讨论】:

    • ... , indexDB 或 web sql
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-25
    • 2020-06-10
    • 2020-05-16
    • 1970-01-01
    • 2012-07-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多