check duplicate browser tab window - Download Check Duplicate Browser Tabs/Windows With jQuery - duplicate.js

Download Check Duplicate Browser Tabs/Windows With jQuery – duplicate.js

Posted on

This time I will share jQuery Plugin and tutorial about Check Duplicate Browser Tabs/Windows With jQuery – duplicate.js, hope it will help you in programming stack.

check duplicate browser tab window - Download Check Duplicate Browser Tabs/Windows With jQuery - duplicate.js
File Size: 3.16 KB
Views Total: 6666
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

duplicate.js is a tiny, useful, jQuery based duplicate window checker that checks if a browser tab/window is already opened using pure JavaScript.

How to use it:

1. Download and put the JavaScript file duplicate.js after loading jQuery JavaScript library.

2         integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
3         crossorigin="anonymous">
4 </script>
5 <script src="duplicate.js"></script>

2. Do something if the current browser tab/window is duplicate.

01 $(document).ready(function () {
02  
03   if (window.IsDuplicate()) {
04  
05     // alert user the tab is duplicate
06     alert("Window Already Opened in Another TabnPlease Click Ok");
07  
08     // close the current tab
09     window.close();
10  
11   }
12    
13 });

This awesome jQuery plugin is developed by AshrafAliS. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net