gpt4 book ai didi

javascript - 我的控制台中跨站点 cookie 的这些警告是什么?

转载 作者:行者123 更新时间:2023-12-05 00:56:07 24 4
gpt4 key购买 nike

我在 Windows 7 上使用 python 3.7.4、django 3.06、javascript 和 jquery。

我不确定它何时发生,但现在我的控制台(Firefox 上的 F12)给了我这些警告:

Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/lists/list-name/” because the scheme does not match. list-name
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/lists/list-name/” because the scheme does not match. list-name
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/lists/list-name/” because the scheme does not match. list-name
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/lists/list-name/” because the scheme does not match. list-name
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/js/common.js” because the scheme does not match. common.js
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/js/common.js” because the scheme does not match. common.js
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/lists/js/lists.js” because the scheme does not match. lists.js
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/lists/js/lists.js” because the scheme does not match. lists.js
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/jsi18n/” because the scheme does not match. jsi18n
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/jsi18n/” because the scheme does not match. jsi18n
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/icons/favicon.png” because the scheme does not match. favicon.png
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/icons/favicon.png” because the scheme does not match. favicon.png

​我正在测试我的代码,我对其进行了一些更改,但与 cookie 或管理无关,而且我的网站对 cookie 的使用非常有限。 PGADMIN_KEYPGADMIN_LANGUAGE 看起来像 django 管理 cookie,我没有碰过它们。 jsi18n 是 django 的翻译模块:不是我的代码,我照原样使用。

这些天我没有进行升级。

我不知道你需要什么代码来帮助我。

我在我的模板中使用了这个(我看到 jquery.cookie 没有更新,但即使 js.cookie.min.js 也会出现同样的问题):

<script type='text/javascript' src=' http://cdn.jsdelivr.net/jquery.cookie/1.4.1/jquery.cookie.min.js '></script>
<script type='text/javascript' src="{% static '/js/common.js' %}"></script>
<link rel='icon' type='image/png' href="{% static 'icons/favicon.png' %}">

对于 cookie 也是如此:

var csrftoken = $.cookie('csrftoken');
function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
xhr.setRequestHeader('X-CSRFToken', csrftoken);
};
}
});

最佳答案

类似的错误,但没有 python 或 django ,已通过清除 cookie(firefox | 开发人员工具 | Storage | cookies...)并刷新页面来解决。

关于javascript - 我的控制台中跨站点 cookie 的这些警告是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62831964/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com