Advanced Search

Results 1 to 3 of 3

Thread: Php/Javascript redirect

  1. #1
    Join Date
    Mar 2011
    Location
    N 11° 19' 0.0012 E 142° 15' 0
    Posts
    1,421
    Thanks
    37
    Thanked 84 Times in 83 Posts
    Blog Entries
    3

    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 keyboard1333; 06-09-2012 at 01:36 AM.
    keebs - keyboard1333 [at] gmail [dot] com
    Anime Views Forums

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    11,797
    Thanks
    227
    Thanked 657 Times in 645 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>| Deutsch | italiano | español | português | català | un peu de français | Ninasoma Kiswahili | 日本語の学生でした。| درست العربية

  3. #3
    Join Date
    Mar 2011
    Location
    N 11° 19' 0.0012 E 142° 15' 0
    Posts
    1,421
    Thanks
    37
    Thanked 84 Times in 83 Posts
    Blog Entries
    3

    Default

    Thanks djr33!
    keebs - keyboard1333 [at] gmail [dot] com
    Anime Views Forums

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
  •