External JavaScript via PHP to only activate if called from a WebPage..block direct access

Discussion in 'PHP & Perl' started by spoofy, Feb 24, 2009.

  1. spoofy

    spoofy Newbie

    Aug 2, 2008
    Likes Received:

    I am trying to figure out a way where I can call an external JavaScript file which would reside inside .php file (myJavaScriptFile.js.php)

    The way it would have to work is that the any webpage would call the JavaScript file so for instance index.php would be able to have the tags <script src=myJavaScriptFile.js></script> and it would do the magic wonders of the javascript file.

    Now the javascript file can only work if called from my specified file, so in this case index.php. It would not allow someone else to access the file either by hotlinking from another site or directly accessing it from the url address bar.