Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to change name on tab when user goes to another tab

window.onload = function() {

  var pageTitle = document.title;
  var attentionMessage = 'Come Back!';

  document.addEventListener('visibilitychange', function(e) {
    var isPageActive = !document.hidden;

    if(!isPageActive){
      document.title = attentionMessage;
    }else {
      document.title = pageTitle;
    }
  });
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: nodejs: redirect path to specific path 
Javascript :: getauth firebase admin node.js 
Javascript :: site:stackoverflow.com two api calls dependent on each other js 
Javascript :: mobile angular service 
Javascript :: HDEL in redis 
Javascript :: documentUrlPatterns 
Javascript :: nodelist example 
Javascript :: express-js 
Javascript :: DataTables warning: table id=datatable - Ajax error 
Javascript :: block scoped in js 
Javascript :: fibonacci sequence array 
Javascript :: schema 
Javascript :: sorting an array 
Javascript :: angular 9 features 
Javascript :: anonymous function 
Javascript :: date pipe 
Javascript :: JavaScript HTML DOM Event 
Javascript :: mongoose getters 
Javascript :: history of react js 
Javascript :: Auto increment in realtime database with javascript 
Javascript :: how to convert json to object 
Javascript :: array example 
Javascript :: js module pattern 
Javascript :: audio get current time 
Javascript :: loop for of 
Javascript :: socket io get user rooms 
Javascript :: react validate 
Javascript :: eliminar duplicados javascript 
Javascript :: filter 2d array javascript 
Javascript :: Detect Mobile / Computer by Javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =