SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow detect a redirect???

    Is there a way that a page can detect a redirect and resume the rest of the actions & If the page did not get accessed by the redirect can it redirect to another page??

    something like:

    <script>java script
    if ("mydestination.php" detects it came from "myredirect.htm"){
    do nothing but continue the actions below;
    }
    else (goto "someotherpage.htm");{
    }
    </script>



    Hope that makes sense


    im totally clueless about this

  2. #2
    SitePoint Zealot
    Join Date
    Jul 2004
    Location
    england
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I understand you correctly, I don't know if you can do that in javascript, but you could use the HTTP_REFERER global in PHP (and I'm sure ASP has a referrer detection).

  3. #3
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If all the pages are your pages, you can use a script to add the page name to the url in a query string. Then, the redirect page can check the name of the page in the query string: if it's not a certain page name, then it can redirect again. Otherwise, I think security reasons will prevent you from seeing where the user came from--as it should be.

  4. #4
    SitePoint Member
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i like the page name idea, i care not WHERE the user has been, only the fact that they are coming from an on site promo page, without having to sign in. is there a tutorial on how to do this anywhere??

    Thanx a bunch, it really helps me out.

    C.

  5. #5
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Search "javascript query strings".

  6. #6
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    don't need to do that, in asp/php you can use a session,

    when the action starts, it will create a session. If the session doesn't exist then redirect if it does do nothing.

    And php also allows you to use querystrings, which in asp you can use request.querystring("action") = "1"

    Gav

  7. #7
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by CGPROD
    if ("mydestination.php" detects it came from "myredirect.htm"){
    That "came from" thing is called "document.referrer".

    http://msdn.microsoft.com/workshop/a...s/referrer.asp


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
  •