Jump to content

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

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.