my webpage is using frames. whenever it detects user closing the windows or log out, it will display a pop up 'thank you message' prompt. the page also has timeout mechanism which will inform user that time elapsed and will redirect page to login page. the problem is that is triggered the 'thank you' pop up message and stalled the redirection. how can i redirect to login page first, then display the 'thank you' pop up message?

You could redirect to the login page with a unique param in the redirect URL. This would inform the login page to display the "thank you" pop up message.
example:
redirect to https://mysite.com/login?thankyou
On the login page a conditional would check if the param "thanyou" exists. If so, display the "thank you" pop up. If not, it's BAU.

If you need tighter validation, you could send a specific value that is checkable from the login page
example:
redirect to https://mysite.com/?thankyou=specificValue1234

On the login page, the conditional checks for the param and then validates the value. If all passes, display the "thank you" pop up. If not, BAU.

Another option would be to set a cookie on the users machine then do the redirect. On the login page, check for the cookie. If it exists, display the "thank you" pop up and then remove the cookie. If not, BAU.

An additional option would be to set a session and then do the redirect. On the login page, check for the session. If it exists, display the "thank you" pop up and then remove the session. If not, BAU.

Not knowing what technologies you have available, I hope these can be useful solutions.

Cheers!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.