Answers for "if browsertab is active jquery"

0

if browsertab is active jquery

document.addEventListener('visibilitychange', function() {
	if(document.hidden)
		console.log('Page is hidden from user view');
	else
		console.log('Page is in user view');
});
Posted by: Guest on January-10-2021
-1

javascript detect if the browser tab is active

var interval_id;
$(window).focus(function() {
    if (!interval_id)
        interval_id = setInterval(hard_work, 1000);
});

$(window).blur(function() {
    clearInterval(interval_id);
    interval_id = 0;
});
Posted by: Guest on April-29-2020

Code answers related to "if browsertab is active jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language