Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/398.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Web Bluetooth API存储连接对象_Javascript_Web Bluetooth - Fatal编程技术网

Javascript Web Bluetooth API存储连接对象

Javascript Web Bluetooth API存储连接对象,javascript,web-bluetooth,Javascript,Web Bluetooth,我们已经成功测试了Web Bluetooth API,它看起来是一个很好的解决方案。但在我们成功地与蓝牙设备配对并检索到gatt服务器之后。由于无法将设备系列化到本地存储,我们如何保存设备?如果我们刷新站点,我们不想再次执行整个请求设备操作,以便能够连接。我想如果我们把设备保存在某个地方,应该可以重新连接 谢谢 Anders如果您只关心刷新,则可以使用以下功能在刷新前向用户显示警报: window.onbeforeunload = function() { return "Are you s

我们已经成功测试了Web Bluetooth API,它看起来是一个很好的解决方案。但在我们成功地与蓝牙设备配对并检索到gatt服务器之后。由于无法将设备系列化到本地存储,我们如何保存设备?如果我们刷新站点,我们不想再次执行整个请求设备操作,以便能够连接。我想如果我们把设备保存在某个地方,应该可以重新连接

谢谢
Anders

如果您只关心刷新,则可以使用以下功能在刷新前向用户显示警报:

window.onbeforeunload = function() {
  return "Are you sure you want to refresh?";
}

如果网站不复杂,你可以考虑使用Ajax代替其他页面导航。