Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js check tab active

let browser_active = ((typeof document.hasFocus != 'undefined' ? document.hasFocus() : 1) ? 1 : 0);
if (!browser_active) {
 // active
} 
Comment

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;
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: js check window active 
Javascript :: how to get the first letter of a string in jquery 
Javascript :: sum numbers recursively js 
Javascript :: how to comment in the react javascript 
Javascript :: jquery keep scroll position 
Javascript :: base64 to png nodejs 
Javascript :: how to divide array in two parts in js 
Javascript :: how to change a string to number in javascript 
Javascript :: javascript random number in range 
Javascript :: isarray 
Javascript :: mysql query node.js 
Javascript :: relode div 
Javascript :: comparsion javascript 
Javascript :: js select element by css selector 
Javascript :: js make node with string 
Javascript :: javascript get url parameters 
Javascript :: javascript pdf preview 
Javascript :: javascript check if object property exists 
Javascript :: smooth scroll to target with offset 
Javascript :: classlist.toggle 
Javascript :: push input value to array javascript 
Javascript :: iterata a array in js 
Javascript :: vue on click router push not working 
Javascript :: how to stop server of react js 
Javascript :: dart list files in directory 
Javascript :: .textcontent 
Javascript :: settimeout in vuejs 
Javascript :: REACt helmet og tags DONT WORK 
Javascript :: jquery if data attribute exists 
Javascript :: react native text span 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =