🖥️프론트엔드/HTML | CSS | JAVASCRIPT
자바스크립트 - 브라우저 탭이 활성화인지 확인하기(document.hidden)
Janger
2023. 2. 5. 16:24
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