首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >对于我的控制台中的跨站点cookie,这些警告是什么?

对于我的控制台中的跨站点cookie,这些警告是什么?
EN

Stack Overflow用户
提问于 2020-07-10 10:05:31
回答 2查看 5.9K关注 0票数 3

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

我不确定何时会发生这种情况,但现在我的控制台(火狐上的F12)给了我以下警告:

代码语言:javascript
复制
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

​我正在测试我的代码,我对它做了一些修改,但与cookies或管理员无关,而且我的站点对cookie的使用非常有限。PGADMIN_KEYPGADMIN_LANGUAGE看起来像django管理cookie,我还没有碰过它们。jsi18n是django的传输模块:不是我的代码,我把它当作是。

这些天我都没做升级了。

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

我在我的模板中使用了这一点(我看到jquery.cookie没有更多更新,但即使是js.cookie.min.js也存在同样的问题):

代码语言:javascript
复制
<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' %}">

这也适用于cookies:

代码语言:javascript
复制
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);
        };
    }
});
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-07-30 07:59:33

正如在一条删除的评论中所说的,这些警告应该来自关于cookie的新政策。cookies来自pgAdmin,包括在PostgreSQL中。

我解决了升级到最后一个版本的pgAdmin和删除缓存中存储的cookie的问题。

票数 4
EN

Stack Overflow用户

发布于 2020-08-02 10:13:25

类似的错误,但没有python或django,通过清除cookie解决了(\ Storage Storage.)并刷新页面。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62831964

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档