“不建议使用"window.webkitStorageInfo"".迭代窗口对象时发出警告 [英] "'window.webkitStorageInfo' is deprecated" warning while iterating window object

查看:5891
本文介绍了“不建议使用"window.webkitStorageInfo"".迭代窗口对象时发出警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请考虑以下html/javascript代码:

Please consider the following code in html/javascript:

<html>
<head>
<script>
    var myObject = {};
    var mySecondReference = myObject;

    for (s in window)
      if (window[s]===myObject)
        alert("reference found: " + s);
</script>
</head>
</html>

迭代窗口对象以搜索对给定对象的任何引用.它在任何地方都可以正常运行,但是在Chrome/ium中会向我发出以下警告:

It iterates though the window object in order to search any references to a given object. It works fine everywhere, however in Chrome/ium gives me the following warnings:

'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.
test.html:8 'webkitIndexedDB' is deprecated. Please use 'indexedDB' instead.

这是我应该害怕的东西吗(尤其是在未来版本的chrome浏览器中)?

Is it something I should be scared of (especially with future versions of chrome browser)?

如何清除这些消息?

推荐答案

您不必担心,如果您不想看到它们,只需对其进行过滤

It's not something you have to worry about, If you don't want to see them, just filter it

var myObject = {};
var mySecondReference = myObject;

for (s in window)
  if (!/webkitStorageInfo|webkitIndexedDB/.test(s) && window[s]===myObject)
    alert("reference found: " + s);

这篇关于“不建议使用"window.webkitStorageInfo"".迭代窗口对象时发出警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆