Refresh webpage on window focus

Do you want to refresh your app page data once page is in focus? Instead on clicking browser refresh button.
Use the following code in controller js (i.e. home.js) to refresh data every time you switched from one tab and back to your app tab, or if you switched from app to another application and back to browser webapp.

$(window).focus(function() {
     $tm1Ui.dataRefresh();
});

This code will trigger either a login screen if user session has timed out or will refresh data automatically once the window is in focus.

3 Likes