D
D
Dima2019-02-05 09:06:42
JavaScript
Dima, 2019-02-05 09:06:42

How to make an action in chrome if a tab is active?

How to show an alert if I click on a tab with a website?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Hog, 2019-02-05
Dolgoter @SpiderPigAndCat

Would this option work?

document.addEventListener("visibilitychange", function() {
  document.visibilityState === 'visible' && alert('Показываю алерт');
});

https://developer.mozilla.org/en-US/docs/Web/Event...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question