Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE 11 Tabs or windows not communicating when over 2 tabs. #50

Open
andyrivera255 opened this issue Dec 19, 2017 · 2 comments
Open

IE 11 Tabs or windows not communicating when over 2 tabs. #50

andyrivera255 opened this issue Dec 19, 2017 · 2 comments

Comments

@andyrivera255
Copy link

You can see this on the example(http://jillelaine.github.io/jquery-idleTimeout/). You open 2 tabs or windows and they do not communicate (notice the screenshot and the time remaining being so far apart). If you press "stay logged in", only one tab dismisses the window.

The code is able to write to the "store" however it is as if it is using 2 different stores, 2 separate session id's or something along those lines. This works fine on Edge, Firefox and Chrome.

Does anyone know the solution?

idletimeout problem

@andyrivera255
Copy link
Author

I got this working by adding an empty onstorage function. Below is the corrected full script tag for the example.html file. Basiclally the onstorage function is forcing Internet Explorer 11 to synchronize the tabs before it does the store.get.

Hope this helps someone.

window.onstorage = function (e) {
  //Leave this empty
  //workaround for IE11 localstorage synchronization problem.
  //the event
};
<script type="text/javascript" charset="utf-8"> $(document).ready(function (){ $(document).idleTimeout({ redirectUrl: '/logout', // redirect to this url on logout. Set to "redirectUrl: false" to disable redirect // idle settings idleTimeLimit: 1200, // 'No activity' time limit in seconds. 1200 = 20 Minutes idleCheckHeartbeat: 2, // Frequency to check for idle timeouts in seconds // optional custom callback to perform before logout customCallback: false, // set to false for no customCallback // customCallback: function () { // define optional custom js function // perform custom action before logout // }, // configure which activity events to detect // http://www.quirksmode.org/dom/events/ // https://developer.mozilla.org/en-US/docs/Web/Reference/Events activityEvents: 'click keypress scroll wheel mousewheel mousemove', // separate each event with a space // warning dialog box configuration enableDialog: true, // set to false for logout without warning dialog dialogDisplayLimit: 20, // 20 seconds for testing. Time to display the warning dialog before logout (and optional callback) in seconds. 180 = 3 Minutes dialogTitle: 'Session Expiration Warning', // also displays on browser title bar dialogText: 'Because you have been inactive, your session is about to expire.', dialogTimeRemaining: 'Time remaining', dialogStayLoggedInButton: 'Stay Logged In', dialogLogOutNowButton: 'Log Out Now', // error message if https://github.com/marcuswestin/store.js not enabled errorAlertMessage: 'Please disable "Private Mode", or upgrade to a modern browser. Or perhaps a dependent file missing. Please see: https://github.com/marcuswestin/store.js', // server-side session keep-alive timer sessionKeepAliveTimer: 600, // ping the server at this interval in seconds. 600 = 10 Minutes. Set to false to disable pings sessionKeepAliveUrl: window.location.href // set URL to ping - does not apply if sessionKeepAliveTimer: false }); }); window.onstorage = function (e) { //Leave this empty //or add code to handle //the event // alert('here'); }; </script>

@yurakis
Copy link

yurakis commented Jan 23, 2020

window.onstorage = function (e) {
//Leave this empty
//workaround for IE11 localstorage synchronization problem.
//the event
};

This worked for me! Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants