Answer the question
In order to leave comments, you need to log in
Is there a polyfill for the onchanged cookie?
https://developer.mozilla.org/en-US/docs/Mozilla/A...
Faced a problem of such a plan that the script does not have time to catch the cookie in the browser.
The script has a defer and it runs only on documentready (everything is somewhat more complicated there, but simplified for this event)
IE - version 11.0.9600.19596 ---- (wrong behavior)
chrom - Version 85.0.4183.121 (Official build), (64 bit) -
firefox works fine - version 81.0 (64-bit) --- (incorrect behavior)
the code that now, I want to rewrite on events, but as always IE
Advise something? or hardcode the delay while the scripts are poking around and writing these cookies?
// failback - guid сайта для записи хоть чего то
function detectLmsId(failback) {
/*
document.cookie
"WSS_FullScreenMode=false; lms_siteinfo=4cb0ec00-c17c-475f-96ed-879e814159bb|97|3"
*/
var cookie = document.cookie;
var cookietoken = 'lms_siteinfo='
var cp = cookie.indexOf(cookietoken)
if (cp > 0) {
cookie = cookie.substr(cp + cookietoken.length, 36);
return cookie
}
return failback
}
Answer the question
In order to leave comments, you need to log in
In general, my answer was not satisfactory.
Decided to start a timer that pulls the function until this parameter is changed.
According to the logs, somewhere in 400ms, this all fits. Works on all 3 browsers plus mobile safari
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question