Determining when a user clicks their browser's back button has never been easier with this jQuery plugin. With a quick easy install and minimal set up work you'll be firing callback functions on back button declarations in no time.
View a demo of it here.
- Download the latest release from here (or
npm install jquery-backdetect
orbower install jquery-backdetect
) - Copy either
jquery.backDetect.js
orjquery.backDetect.min.js
to your scripts folder - Include the script after you call on
jQuery
| | | | | |:---:|:---:|:---:|:---:|:---:| | All ✔ | All ✔ | 8+ ✔ | All ✔ |
Can append to any element or class:
<script src='backdetect.jquery.js'></script>
<script>
$(window).load(function(){
$('body').backDetect(function(){
// Callback function
});
});
</script>
You can set a delay intiate the back detect. Very similar to setting the time in setTimeout:
<script src='backdetect.jquery.js'></script>
<script>
$(window).load(function(){
$('body').backDetect(function(){
// Callback function
});
}, 1000); // <- 1 second delay
</script>
Settings | Default Value | Description |
---|---|---|
delay | delay: 0 |
The length of time it takes for the backDetect plugin to fire and monitor when a user hits the back button. |
1.0.2 Added backDetect to npm
and bower
repos.
1.0.1 Removed the need for the 1x1.png image for IE.
__
_,..,_ (, )
.,' `,./
.' :`.----.': `,
: : ^ ^ : ;
: : 6 6 : ;
: : : ;
: : __ : ;
< MIT > : `:'.--.`:' ;
`. : o o : .'
: `----' :
: . :'`: . :
`.:.' `.:.'