How to show warning popup before session timeout?

I added SSO Session Idle for 30 minutes and SSO Session Max for 10 hours but when user login to the application ,the session will get over after 15-20 minutes. So I want a warning pop like “you have left 15 minutes before session time out”. So is there any API through which we can get how much time is left for session timeout?