Javascript / PHP help needed ...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 4Pics
    Confirmed User
    • Dec 2001
    • 7952

    #1

    Javascript / PHP help needed ...

    Is there any way via window.open to have it pass the referring url?

    It seems to do it on some IE's and always in Firefox. So far I think my only way is to do a window.open and then have a gateway page but I didn't want to do that if I didnt have to.

    Thanks
  • Varius
    Confirmed User
    • Jun 2004
    • 6890

    #2
    If I"m understanding you right, couldn't you just append the current url to the new page you are opening, as a parameter?
    Skype variuscr - Email varius AT gmail

    Comment

    • 4Pics
      Confirmed User
      • Dec 2001
      • 7952

      #3
      The page I am opening wants to make sure its coming from www.domain.com but if you use window.open that is blank for some reason in most browsers, firefox seems to pass it and some pc's here do too.

      Comment

      • Varius
        Confirmed User
        • Jun 2004
        • 6890

        #4
        If you rely on the browser, I think you are out of luck....

        "The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted."

        Thus, I think the only 100% method would be to pass it as a parameter...it does mean the page being opened would have to accept and read that parameter though.
        Skype variuscr - Email varius AT gmail

        Comment

        • Varius
          Confirmed User
          • Jun 2004
          • 6890

          #5
          Note: If you pass it as a param, it loses any real use security-wise...as anyone could pass whatever info they want.

          You'd have to use some encryption.
          Skype variuscr - Email varius AT gmail

          Comment

          • 4Pics
            Confirmed User
            • Dec 2001
            • 7952

            #6
            thanks That's what I got from a few google searches, just wanted to make sure there wasn't some other hack to make it work.

            Comment

            • mortenb
              Confirmed User
              • Jul 2004
              • 2203

              #7
              you could do it with a pretty simple javascript..

              put this in the popup window..

              Code:
              if(window.opener.document.location.href!="http://www.yourdomain.com/somepage.html") {
                  alert("bahh.. you didn't come here from the correct page");
              }

              Comment

              Working...