连IE8及以上都能够支持,为什么Edge不能够支持?
if(window.localStorage){ alert('This browser supports localStorage'); }else{ alert('This browser does NOT support localStorage'); }
下面是Edge版本:
欢迎选择我的课程,让我们一起见证您的进步~~
EDGE does not support localStorage in local files (this seems to be the case for IE10 and 11) You need to build a server and try again Or you can open F12 directly in the segmentfault webpage Try again and it will be supported
It is supported, but your code cannot tell whether it is supported! You'd better check the context of your code, the introduction method, etc.
Check whether it can output in the browser debugging console, F12-Console, enter localStorage below, and press Enter.
I copied your code and ran it in Edge, the results are as follows:
It can be seen that it is supported. Is there something wrong with your step? Try printing window.localStorage in cosole
EDGE does not support localStorage in local files (this seems to be the case for IE10 and 11)
You need to build a server and try again
Or you can open F12 directly in the segmentfault webpage Try again and it will be supported
It is supported, but your code cannot tell whether it is supported!
You'd better check the context of your code, the introduction method, etc.
Check whether it can output in the browser debugging console, F12-Console, enter localStorage below, and press Enter.
I copied your code and ran it in Edge, the results are as follows:
It can be seen that it is supported. Is there something wrong with your step? Try printing window.localStorage in cosole