diff --git a/grails-app/assets/javascripts/base-bs4.js b/grails-app/assets/javascripts/base-bs4.js index 8a8fdc630..c414fa70f 100644 --- a/grails-app/assets/javascripts/base-bs4.js +++ b/grails-app/assets/javascripts/base-bs4.js @@ -91,6 +91,11 @@ function setupTimeoutWarning(options) { window.addEventListener('offline', function() { fireKeepAlive(); }); + window.addEventListener('visibilitychange', function() { + if (!document.hidden) { + fireKeepAlive(); + } + }); } diff --git a/grails-app/controllers/au/org/ala/merit/HomeController.groovy b/grails-app/controllers/au/org/ala/merit/HomeController.groovy index da15d53e9..04b277da2 100644 --- a/grails-app/controllers/au/org/ala/merit/HomeController.groovy +++ b/grails-app/controllers/au/org/ala/merit/HomeController.groovy @@ -248,9 +248,16 @@ class HomeController { renderStaticPage(SettingPageType.CONTACTS, false) } + /** + * Returns a small amount of javascript to let other tabs know the user has been logged back in + * and closes the tab. + */ def close() { response.setContentType("text/html") - render """
""" + render """
""" } def staticPage(String id) {