Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
24
rated 0 times [  26] [ 2]  / answers: 1 / hits: 18556  / 13 Years ago, mon, may 30, 2011, 12:00:00

lets say i'm making a festival website, and if you enter today you will se the 2010 edition because the 2011 edition it's not finished,



And i want to let to my users know that they are seing the old website and that they will be redirected to the facebook page (untill the new website its finished),



with this code i would be redirecting to our facebook page



<SCRIPT LANGUAGE='JavaScript'>
window.alert('This is the old edition of our webiste. The new one will be avaliable soon. You would be redirected')
window.location.href='http://facebook.com/ourfacebookpage';
</SCRIPT>


But how could i do to allow user staying? (example, cancel / stay here button) so user can see the old website (but he knows it's the old website)



thanks a lot for any idea!


More From » alert

 Answers
6

The simplest way is to use window.confirm(). It's like alert() but it has 2 buttons: OK and Cancel. It returns true if the user pressed OK and returns false if the user pressed Cancel.



<script>
if (window.confirm('This is the old edition of our webiste. The new one will be avaliable soon. You would be redirected')) {
window.location.href='http://facebook.com/ourfacebookpage';
}
</script>


But having a confirm window popup on page load may surprise users. You can make that more subtle by putting the message on your page (with link to your facebook page) instead of popping up the alert/confirm box, and have another link that removes that message from the page (maybe using JavaScript).


[#91974] Saturday, May 28, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
blaisep

Total Points: 748
Total Questions: 95
Total Answers: 108

Location: Federated States of Micronesia
Member since Sun, May 16, 2021
3 Years ago
blaisep questions
Wed, Dec 16, 20, 00:00, 4 Years ago
Sun, Aug 16, 20, 00:00, 4 Years ago
Tue, Nov 12, 19, 00:00, 5 Years ago
Mon, Nov 11, 19, 00:00, 5 Years ago
;