JQuery $ .cookie (domain :) calling cookie not to set

Hi, the following code sets Cookies based on the identifier of the link that was clicked (this value), it works, but what needs to be done to set the domain, I read how to do this by setting the domain in the values, when I install domin, it doesn’t will set a cookie at all

AT:

jQuery(document).ready(function(){
    $(".htabs a").click(function(e){
        $.cookie('siteVistedCookie', $(this).attr("id"), { expires: 7, path: '/'});
        });
    });

Does not work

jQuery(document).ready(function(){
    $(".htabs a").click(function(e){
        $.cookie('siteVistedCookie', $(this).attr("id"), { expires: 7, path: '/', domain: 'www.xample.com' });
        });
    });
+3
source share
2 answers

Just guess here, but if the domain you are trying to set is not the domain of the site where the page is hosted, then the domain (host) will not be set in the cookie for what you enter as the domain in the cookie adjuster.

, , cookie, .

xample.com, xample.com/testcookie.html( ), () cookie xample. .

+7

script , cookie, . ? , ?

cookie () , . ,

http://www.somesite.com/page.htm L

cookie

www.somesite.com < - www

.somesite.com < - somesite.com

+2

All Articles