This tells you when someone returns to your webpage after changing browser tabs
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
img
.gitignore
Gruntfile.js
README.md
bg.jpeg
index.html
package.json
tab-change.js

README.md

TabChange.js

This tells you when someone returns to your webpage after changing browser tabs

This is forked from http://code.tutsplus.com/articles/html5-page-visibility-api--cms-22021. I basically just wrapped it in a function and gave it a callback.

Demo: http://benrlodge.github.io/tab-change/

How to use:

TabChange(function(){
  // tab has been changed
});

Options

The callback returns an object. Right now the object only returns the number of times the visitor changed a tab and returned. Feel free to open an issue if you have any ideas for other info that would be helpful to return.

TabChange(function(change){
  console.log(change.count);
});