简体   繁体   English

有没有办法用 HTML 请求访问计算机上的本地存储?

[英]Is there a way to ask for access to local storage on a computer in HTML?

I am trying to convert a Google Chrome App into a Web app.我正在尝试将 Google Chrome 应用程序转换为 Web 应用程序。 I have all the web app made except I ran into one problem.除了遇到一个问题之外,我已经制作了所有网络应用程序。 In the code it says,在代码中它说,

`chrome.system.storage.getInfo(function(info){ `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";
  }
});`

except when you are in the browser this doesn't work because you don't have access to the "chrome.system.storage".除非您在浏览器中,否则这不起作用,因为您无权访问“chrome.system.storage”。 Is there a way to get access to that?有没有办法访问它?

Thanks谢谢

That API is only available to extensions.该 API 仅适用于扩展程序。 If you want storage, use localStorage or sessionStorage instead.如果需要存储,请改用 localStorage 或 sessionStorage。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM