darksniperx Posted November 25, 2007 Share Posted November 25, 2007 echo " <script>window.setTimeout('window.location='index.php?page=main_page'; ',2000);</script>"; I had too much trouble with header php header, so I switched to js. Quote Link to comment https://forums.phpfreaks.com/topic/78801-solved-js-redirect-in-php-not-working/ Share on other sites More sharing options...
nuxy Posted November 25, 2007 Share Posted November 25, 2007 Try this, with single echo quotes.. <?php echo '<script>window.setTimeout("window.location=\'index.php?page=main_page\';",2000);</script>'; ?> Edit: Also, I think it should be just "setTimeout()" rather than "windows.setTimeout()", not such a big javascript wiz. Quote Link to comment https://forums.phpfreaks.com/topic/78801-solved-js-redirect-in-php-not-working/#findComment-398799 Share on other sites More sharing options...
darksniperx Posted November 25, 2007 Author Share Posted November 25, 2007 Try this, with single echo quotes.. <?php echo '<script>window.setTimeout("window.location=\'index.php?page=main_page\';",2000);</script>'; ?> Edit: Also, I think it should be just "setTimeout()" rather than "windows.setTimeout()", not such a big javascript wiz. your code works, also I have remembered to use ?> <script>window.setTimeout('window.location="index.php?page=main_page"; ',2000);</script>"; <?php Quote Link to comment https://forums.phpfreaks.com/topic/78801-solved-js-redirect-in-php-not-working/#findComment-398806 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.