๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ–ฅ๏ธํ”„๋ก ํŠธ์—”๋“œ/HTML | CSS | JAVASCRIPT

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ - ๋ธŒ๋ผ์šฐ์ € ํƒญ์ด ํ™œ์„ฑํ™”์ธ์ง€ ํ™•์ธํ•˜๊ธฐ(document.hidden)

by Janger 2023. 2. 5.
728x90
๋ฐ˜์‘ํ˜•

 

if (document.hidden)
    console.log('๋น„ํ™œ์„ฑํ™”');
else
	console.log('ํ™œ์„ฑํ™”');

 

์ถœ์ฒ˜: 

https://stackoverflow.com/questions/1760250/how-to-tell-if-browser-tab-is-active

 

How to tell if browser/tab is active

Possible Duplicate: Is there a way to detect if a browser window is not currently active? I have a function that is called every second that I only want to run if the current page is in the

stackoverflow.com

 

728x90
๋ฐ˜์‘ํ˜•