I'm having problems with a duplicate tab on Chrome (session's stuff) and I'd like to avoid the action of duplicating tabs (or lacking that close the duplicate one). I'm opening the tab as it was a popup, with no address bar, no status bar, and no nothing, just the window. There's no way to duplicate a tab (opened as a popup) in IE and Firefox (at least I havent found one), but in chrome is still possible.
I also know I'm not able to programmatically check if there's an already open duplicated tab
Any idea how to approach this?
thanks!
The hotkey Alt + Shift + W will close all duplicate tabs in one go. The shortcut isn't customizable. Speaking of which, you can always use the undo close tab shortcut in Chrome/Firefox (Ctrl + shift + T) to get your tabs back in case you closed something by mistake.
Add “Unique Tabs” to your Chrome to suspend duplicate tabs upon opening a new tab or navigating to a new page. As compared to other extensions, Unique Tabs displays a notification before closing tab. Clicking “Cancel” in the notification within a delay of 5 seconds will prevent the tab from being closed.
If you wanted to view another product page from the same search results, you can duplicate the browser tab. The first product's page remains open in the duplicated tab, allowing you to go back to the search results in the first tab and view the second product's page.
So, that might be a good-enough solution. First sort tabs by "Website", then it's easier to go through them with command + shift + ] and remove duplicates.
In onLoad
function, I used window.performance.getEntriesByType("navigation")[0]).type
for check duplicate tab in browser.
If type value is back_forward
, that value is duplicate tab.
I share for whom concerned.
var navigationType = (window.performance.getEntriesByType("navigation")[0]).type;
//back_forward value is duplicate tab
if(navigationType == 'back_forward'){
alert('Can not concurrent edit dashboard...');
}
My application required that a user can only sign on once so I can use the localStorage to reliably cache records. The signon uses localStorage flags to enforce this requirement and uses the window.name to know which user owns the tab.
The issue was that the browser duplicate tab facility messed up the enforcement. The code below forces a signon page to appear in the duplicated tab if they duplicate a signed on session.
This solution was tested in Chrome. It makes use of the fact that a duplicated tab has no name. This characteristic may not exist in all browsers.
The preventDuplicateTab function is called very early in the page load sequence.
/* This prevents users from duplicating the tab. If they do it
* triggers the start page which checks for duplicate userid
*/
function preventDuplicateTab() {
if (sessionStorage.createTS) {
// Chrome at least has a blank window.name and we can use this
// signal this is a duplicated tab.
console.log("Existing sessionStorage "+sessionStorage.createTS+"
w.name="+window.name);
if (!window.name) {
window.name = "*ukn*";
sessionStorage.createTS = Date.now(); // treat as new
window.location = "/res/Frame.htm?page=start.htm"; // force to
signon screen
}
} else {
sessionStorage.createTS = Date.now();
console.log("Create sessionStorage "+sessionStorage.createTS+"
w.name="+window.name);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With