Jump to content

javascript before redirect


homer.favenir

Recommended Posts

hi,

can anyone please tell me how to execute javascript first before redirect?

 

i have a script here but it skips javascript and executes javascript.

<script language="JavaScript">
            alert ("Put your warning text here!")
            [removed]
        <?php 
            redirect('Front_cont/input_dir_ufpb_wp');
        ?>
</script>
i want to check if a file exist, 
if that file doesnt exist, it pops up an alert box and return to the 
input text page.

the problem is it skips the alert message and just redirect the page.

please advice.

thanks

Link to comment
https://forums.phpfreaks.com/topic/131295-javascript-before-redirect/
Share on other sites

i made it working now.

i just made a new page

when a file doesnt exist it will go to that page

and in that page is the javascript

<html>
<head>
<script type="text/javascript">
<!--
function delayer(){
    window.location = "<?php echo 'input_dir_ufpb_wp'; ?>"
}
//-->
</script>
</head>
<body onLoad="setTimeout('delayer()', 5000)">
<h2>Prepare to be redirected!</h2>
<p>This page is a time delay redirect, please update your bookmarks to our new 
location!</p>

</body>
</html>

 

thanks

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.