SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    How do I get a link within iframe?

    I work in a company and will make a web site for a little holiday thing.
    We will send a link to a couple of our close customers and that link will be personal (with a code attached at the end).

    Something like: www.comapany.com/holiday.html?code=12345

    Then they will end up in our simple web site and inside this page I have an iframe which is linked to my personal php/mysql web site where I can do my own stuff the way I want it. So the customers still think they are at the company web site (that's why I use iframe).

    But how do I get that code inside my iframe page to work with?
    Since they will recieve a small gift, which is personal, so I need to check the code. I thought about setting a session for the code and then be able to work with it when they are online.

    Since the company web site is only working with html I need to get the code from the url... but how?

  2. #2
    Forums Designer
    Join Date
    Jun 2004
    Posts
    422
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try checking $_SERVER['HTTP_REFERER'], but I'm not sure if it will include top frame's url or url that user clicked to get to it. Also user might have referer disabled in his browser.

    Another solution is to use javascript. On your landing page output code like this:
    Code:
    <html>
    <body>
    <script language="JavaScript">
    <!--
    document.location.href = 'yourscript.php?top=' . escape(top.location.href);
    //-->
    </script>
    </body>
    </html>
    which will redirect you to your real page with url of top frame in parameter "top".

    I haven't tested any of it, so its just an idea that might work.

  3. #3
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thanks. The referer did work fine. Now I just need to make the rest of the things work.


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
  •