window.addEventListener("load", function() { $.ajax({url: 'https://app.distant-office.ru/api/chat_v3/auth_token.php', dataType:'json', type: 'GET', xhrFields: { withCredentials: true }, crossDomain: true, success: function(data){ //~ console.log(data.login); // _dc('saw_t2', "/"); // _dc('saw_t1', "/"); // _dc('saw_ec', "/"); if (data.login) { var d = new Date(); d.setMonth(d.getMonth() + 12); // d.setDate(d.getDate() + 12); // +12 month // _sc('android_id_install', data.android_id_install, d, "/"); // _sc('device_token', data.device.token, d, "/"); _sc('device_token', data.device.token, d, "/"); _sc('android_id_install', data.android_id_install, d, "/"); window.location.reload(); } else { $("head").append($('\ \ \ \ ')); $("body").append($('\