Skip to content

jQuery backDetect is a jQuery plugin that is used to determine when a user clicks the back button and fire a callback function.

Notifications You must be signed in to change notification settings

nrajasiddharthan/jquery-backDetect

 
 

Repository files navigation

backDetect

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.

Installation


  • Download the latest release from here (or npm install jquery-backdetect or bower install jquery-backdetect)
  • Copy either jquery.backDetect.js or jquery.backDetect.min.js to your scripts folder
  • Include the script after you call on jQuery

Browser Support

| Chrome logo | Firefox logo | Internet Explorer logo | Safari logo | |:---:|:---:|:---:|:---:|:---:| | All ✔ | All ✔ | 8+ ✔ | All ✔ |

Basic Usage

Can append to any element or class:

<script src='backdetect.jquery.js'></script>
<script>
		$(window).load(function(){
			$('body').backDetect(function(){
				// Callback function
			});
		});
</script>

Custom Options

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.

Change Log

1.0.2 Added backDetect to npm and bower repos.

1.0.1 Removed the need for the 1x1.png image for IE.

Licence

		                    __
		            _,..,_ (, )
		         .,'      `,./
		       .' :`.----.': `,
		      :   : ^    ^ :   ;
		     :   :  6    6  :   ;
		     :   :          :   ;
		     :   :    __    :   ;
< MIT >       :   `:'.--.`:'   ;
		       `.  : o  o :  .'
		        :   `----'   :  
		        : .  :'`:  . :
		        `.:.'    `.:.' 

About

jQuery backDetect is a jQuery plugin that is used to determine when a user clicks the back button and fire a callback function.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 59.8%
  • JavaScript 21.2%
  • HTML 19.0%