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. 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. 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 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
Archived
This topic is now archived and is closed to further replies.