Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2005
    Posts
    1

    Unanswered: if ref="url" then popup page

    I am trying to make a webpage do a popup window but only when coming from a certain url. This code will be on the homepage, so when the link from the certain url is clicked, the homepage will load, but also the window will popup. This is what I have coded:
    <?php
    $ref=@$HTTP_REFERER;
    If ($ref = "http://www.winningedge.com") {
    ?>


    <script>onLoad="MM_openBrWindow('coupon/COUPON.gif','','width=400,height=420')"</script>

    <?php
    ;}
    ?>

    I am pretty new to php, so if this is completely off....?
    I would love some help with this.

  2. #2
    Join Date
    Apr 2005
    Location
    Baltimore, MD
    Posts
    297
    Pretty sure this can be done in javascript. Is there any specific reason why you want to do it in php?

    Try something like this.

    Code:
    <script>
    function checkReferer() {
       if (document.referrer ==  "http://www.winningedge.com") {
            MM_openBrWindow('coupon/COUPON.gif','','width=400,height=420');
       }
    }
    </script>
    
    <body onload="checkReferer()">

    If you do want to do it in php try changing the following (not sure if this is 100% correct):
    $ref=@$HTTP_REFERER;
    If ($ref = "http://www.winningedge.com") {
    to
    Code:
    If ($_SERVER['HTTP_REFERER'] == "http://www.winningedge.com") {
    (note the '==' for comparison)

    Hope this helps.

  3. #3
    Join Date
    Oct 2005
    Posts
    3
    I like your JS solution.

Posting Permissions

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