c# - How to restrict user in opening multiple Tabs in a browser while performing tasks? -


i have restrict users in opening multiple tabs of browser security purposes bank. want user perform tasks in single tabs of browser only.

if try open multiple tabs user ids must forcefully log out.

i don't know how this.

please me out or provide me logic s this.

thanks in advance.

first, have agree other users -- if having more 1 tab open security issue, have problems. big problems.

however, if still want this:

when user logs in:

// must string var datetimestamp = "" +new date().gettime();  // 1 can seen windows/tabs localstorage.setitem("timekey", datetimestamp); // 1 can seen current window/tab sessionstorage.setitem("timekey", datetimestamp); 

now, when page loads, check see if 2 values match:

var localkey = localstorage.getitem("timekey"); var sessionkey = sessionstorage.getitem("timekey");  // if there key: if (localkey) {   if (localkey !== sessionkey) {     // handle multiple login here? redirect login page?     // complain tab?   } } 

then, when user logs out, make sure remove both of keys.

localstorage.removeitem("timekey"); sessionstorage.removeitem("timekey"); 

warning:

this kind of coding bit fragile , no doubt there edge case missed.

extra credit

it possible monitor changes localstorage , force other pages log out if logs in on new tab.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -