使用Firefox Quantum从Javascript中的本地驱动器获取Cookie [英] Getting cookies from local drive in Javascript using Firefox Quantum

查看:61
本文介绍了使用Firefox Quantum从Javascript中的本地驱动器获取Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用我的Javascript代码在cookie中存储了一些信息.在安装Firefox Quantum之前,我没有问题可以从本地驱动器进行设置和读取它们.

I store some info in cookies in my Javascript code. I have had no problem to set and read them from local drive until Firefox Quantum installed.

现在看来,cookie已设置(在cookie中进行了检查),但是如果我打开html文件,则无法读取.document.cookie.length值始终为零.但是,如果我设置cookie并刷新浏览器(或再次打开文件而不关闭第一个文件),则可以读取cookie.

Now it seems that the cookies are set (been checked among the cookies), but cannot be read if I open the html file. The document.cookie.length value is always zero. Yet if I set the cookies and refresh the browser (or open the file again not closing the first file) the cookies can be read.

到目前为止,Firefox可以使用file:///来存储和读取cookie,但这对我来说是新的.我猜有些设置必须更改.

So far Firefox stored and read cookies all right using file:///, but this twist is new for me. Some setting has to be changed, I guess.

有人可以告诉我一个解决方案,如何允许再次从本地驱动器读取cookie吗?

Can anybody tell me a solution, how to allow to read the cookies again from local drive?

谢谢.

推荐答案

由于安全问题和其他问题,Firefox Quantum(与Google Chrome和其他浏览器一样)已禁用存储cookie的本地文件.HTML5 Web存储命令取代了服务器和本地网页的cookie.请参阅" https://www.w3schools.com/html/html5_webstorage.asp "

Firefox Quantum (as with Google Chrome and others) has disabled storing cookies for local files due to security issues and other problems. The HTML5 web storage commands are taking over what used to be done with cookies for both server and local web pages. See "https://www.w3schools.com/html/html5_webstorage.asp"

这篇关于使用Firefox Quantum从Javascript中的本地驱动器获取Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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