Greetings,
I'm having a problem with IE 6. While it's still working with Opera, IE6 isn't sending a referer through to php (or php isn't handling it, or something) when a user clicks a table cell with the "onClick" statement.

My goal here is to force a user to navigate the on-site links through my page, and not allowing them access via the URL to certain sections of my site. I'm doing this by checking that the referer every page comes from my site. On my site I have table cells that link to these other pages using the "onClick" function. When I click on one of these, my php kicks in and doesn't give me access, saying that I need to follow the "on-site links" to browse. When I check the referer, there's nothing there. It's blank.

Any suggestions???

    First of all, if you're using $HTTP_REFERER in PHP to validate something for security, you should be aware that this isn't always as secure as you may think. The dependency on whether or not a referer variable is sent to the server relies on the browser, and not all browsers will send it....you have been warned 😃

    As for the Jscript...sorry, the only way you can have a Javascript link properly send a referer variable to the server is if you have that javascript interact with another element in that page that actually sends the request (such as a form).

    For example:

    <a href="#" onClick="javascript:document.location='page.php'">This Link won't work</a>
    
    <form name="theForm" action="page.php" method="get">
    </form>
    <a href="javascript:document.theForm.submit()">This link will work</a>  (and it will send a referer variable to the server)
    

      grrrrrrrr...

      Ok. I guess I'll just have to use the the referer only on submitted forms, then.

        Originally posted by epp_b

        <form name="theForm" action="page.php" method="get">
        </form>
        <a href="javascript:document.theForm.submit()">This link will work</a> (and it will send a referer variable to the server)

        Ooh, I'll have to try this. This might be a way around my current problems.

          Write a Reply...