From e5484ee833a9844c69420bbd5b1508cf6a04e1d1 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Mon, 20 May 2019 20:06:55 +0200 Subject: [PATCH] provide tab id --- lam/templates/lib/500_lam.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lam/templates/lib/500_lam.js b/lam/templates/lib/500_lam.js index f302cafb..85c31b58 100644 --- a/lam/templates/lib/500_lam.js +++ b/lam/templates/lib/500_lam.js @@ -1111,6 +1111,23 @@ window.lam.html.preventEnter = function() { }); } +window.lam.tabs = window.lam.tabs || {}; + +/** + * Returns the id of the current browser tab. + * + * @returns tab id + */ +window.lam.tabs.getTabId = function() { + var lamTabId = sessionStorage.getItem('lamTabId'); + if (!lamTabId) { + var date = new Date(); + lamTabId = date.getTime() + '-' + Math.floor(Math.random() * 10000000000); + sessionStorage.setItem('lamTabId', lamTabId); + } + return lamTabId; +} + window.lam.selfservice = window.lam.selfservice || {}; /**