最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What are these warning for cross-site cookie in my console? - Stack Overflow

programmeradmin0浏览0评论

I'm using python 3.7.4, django 3.06, javascript and jquery on windows 7.

I'm not sure when it happens but now my console (F12 on firefox) gives me these warning:

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/mon.js” because the scheme does not match. mon.js
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/js/mon.js” because the scheme does not match. mon.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

​I was testing my code, I made some change to it but nothing related to cookies or admin and my site has a very limited use for cookies. PGADMIN_KEY and PGADMIN_LANGUAGE look like django admin cookies and I haven't touched them. jsi18n is the traslation module for django: not my code, I took it like it was.

I haven't done upgrades in these days.

I don't know what code you can need to help me.

I use this in my template (I see jquery.cookie is not more updated but even js.cookie.min.js gives the same problem):

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

also this for cookies:

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);
        };
    }
});

I'm using python 3.7.4, django 3.06, javascript and jquery on windows 7.

I'm not sure when it happens but now my console (F12 on firefox) gives me these warning:

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/mon.js” because the scheme does not match. mon.js
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/js/mon.js” because the scheme does not match. mon.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

​I was testing my code, I made some change to it but nothing related to cookies or admin and my site has a very limited use for cookies. PGADMIN_KEY and PGADMIN_LANGUAGE look like django admin cookies and I haven't touched them. jsi18n is the traslation module for django: not my code, I took it like it was.

I haven't done upgrades in these days.

I don't know what code you can need to help me.

I use this in my template (I see jquery.cookie is not more updated but even js.cookie.min.js gives the same problem):

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

also this for cookies:

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);
        };
    }
});
Share Improve this question asked Jul 10, 2020 at 10:05 fabiofabio 1,3652 gold badges29 silver badges58 bronze badges 2
  • 1 I also strongly suggest you load a) a newer jQuery and b) load it over HTTPS – mplungjan Commented Jul 10, 2020 at 10:14
  • @mplungjan I made the changes you suggest and I read same articles but the solution isn't clear yet. The cookies pgadmin_key and pgadmin_language e from my database postgresql and I didnt set them explicitly so it's something that should be resolved by postgres developers, right? – fabio Commented Jul 12, 2020 at 19:00
Add a ment  | 

2 Answers 2

Reset to default 4

similar error, but without python nor django , was solved by clearing the cookies (firefox | developper tools | Storage | cookies...) and refreshing the page.

The warnings, like said in a deleted ment, should e from the new policy about cookies. The cookies es from pgAdmin, included in PostgreSQL.

I solved upgrading to the last version of pgAdmin AND deleting the cookies stored in the cache.

发布评论

评论列表(0)

  1. 暂无评论