We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b8f488d commit 57c6c37Copy full SHA for 57c6c37
Clock Time.js
@@ -308,4 +308,21 @@ function addIframe() {
308
309
iframe.parent(container);
310
iframe.position(posXIframe* factorScale,posYIframe* factorScale);
311
-}
+}
312
+
313
+window.addEventListener('beforeunload', (event) => {
314
+ // Cancel the event as stated by the standard.
315
+ event.preventDefault();
316
+ // Chrome requires returnValue to be set.
317
+ event.returnValue = '';
318
+ });
319
320
+ document.addEventListener('visibilitychange', function() {
321
+ if (document.hidden) {
322
+ console.log('User switched to another tab');
323
+ alert('You have switched to another tab!');
324
+ } else {
325
+ console.log('User switched back to the tab');
326
+ alert('Welcome back to the tab!');
327
+ }
328
+});
0 commit comments