简体   繁体   中英

Javascript redirect then show a message

I'm using a basic timed redirect to logout function and would like it to display a message in the location of my choosing after the redirect has completed, IE on a different page to where the redirect was called.

   <script type="text/javascript">   
   function Redirect() 
   {  
   window.location="../../../../Applications/logout.asp"; 
   } 
   setTimeout('Redirect()', 5000);   
   </script>

I know I can use the basic alert or write, but I'd specifically like the message to be shown in a div of my choice on the target page, is that even possible?

You can pass a parameter to the page you are redirecting, kind of like

window.location="../../../../Applications/logout.asp?sessionTimeOut=true";

and then check this parameter on the other page. If it is TRUE you can put a specific message on whenever you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM