Alert and redirect javascript code

Here is a simple redirect and alert code in javascript.

1
2
3
4
5
6
<script language="Javascript">
<!--
alert ("You have a message!")
window.location = "index.php"
-->
</script>

It will redirect the page and before that, it will create a small pop-up (from the browser), with a message for the user.

And with php echo for those who want to do just a copy paste.

2
3
4
5
6
7
echo'<script language="Javascript">
<!--
alert ("You have a message!")
window.location = "index.php"
-->
</script>';

ADD A COMMENT: