Results 1 to 3 of 3

Thread: Php/Javascript redirect

  1. #1
    Join Date
    Mar 2011
    Posts
    2,144
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default Php/Javascript redirect

    Is there any reason not to do this (if I also provide a manual button incase they have got javascript disabled)
    PHP Code:
    <?php
    echo '<script type="text/javascript"> window.location = "../..' $lastPage '"; </script>';
    ?>
    instead of
    PHP Code:
    <?php
    header
    ('location:../..' $lastpage);
    ?>

    Because I need to redirect based on a condition after some content has been loaded...
    Thanks, Keyboard1333
    Last edited by keyboard; 06-09-2012 at 01:36 AM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    No reason as long as you don't mind letting the page load first. It will be a lot like a lot of forums and so forth with "please wait while we redirect you..."

    Alternatively, you can use a meta refresh tag (with a URL to redirect), which will be a little more reliable in case Javascript is disabled. Still provide the link just in case, but that will work 99%+ of the time.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Mar 2011
    Posts
    2,144
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •