Why the code does not take cookies?

Tell me what's wrong or what's missing , the site has a system - check the box of the ad and it is stored in the cookie and then open Notepad in a new window and there is an ad in front of which stood the check mark .
Only after opening the window ad there not loaded , and after refreshing the page, mark that in the notebook there is a record disappears .
//// the notebook

window_notepage function()
var height_w=screen.height-250;
var left = (screen.width/2)-(650/2);
var top = (screen.height/2)-(height_w/2);
window.open('notepage.html','note_board','width=650,height='+height_w+',top='+top+',left='+left+',toolbar=0, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, history=no');
add2note function()
 function str_replace(search, replace, subject) { return subject.split(search).join(replace);}
var button = document.getElementById('addnotepage');
var Link2Note = document.getElementById('Link2Note');
var count_note_message = 0;
var id = 731000;
var fid = 2;
value = fid+"i"+id+"s";
var cookies = getCookie("BoardNote");
if (cookies == undefined) cookies = "";

//check if it's the ad cookies in Notepad?
if (cookies.search(value)!= -1) 
 //if there, remove
 value = str_replace(value,"",cookies);
 button.style.backgroundImage = 'url(img/check_icon_off.png)';
 button.style.borderColor = '#aaaaaa';
 button.style.backgroundColor = '#eeeeee';
 button.title='add to Notepad';
 count_note_message = value.split("s").length - 1;
 if (count_note_message>0) Link2Note.innerHTML = "<u>Notepad ("+count_note_message+")</u>";
 if (count_note_message<=0) Link2Note.innerHTML = "<u>Notepad</u>";

 //if not, add
 value = cookies+value;
 button.style.backgroundImage = 'url(img/check_icon.png)';
 button.style.borderColor = '#88ee88';
 button.style.backgroundColor = '#eeffee';
 button.title='Remove from clipboard?';
 count_note_message = value.split("s").length - 1;
 if (count_note_message>0) Link2Note.innerHTML = "<u>Notepad ("+count_note_message+")</u>";
setCookie("BoardNote", value, { expires: 3600*24*30, path: "/", domain: ".a0174767.xsph.ru" });
June 10th 19 at 14:32
1 answer
June 10th 19 at 14:34
I think you did something with the domain. In any case, I advise you here this baby:
Kizzy which weighs 2KB and is easier to work with cookies, replacing the storage in the localStorage.

Find more questions by tags HTTP CookiesJavaScript