1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

    Joined:
    Aug 2, 2008
    Messages:
    14
    Likes Received:
    2
    Hello,

    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.

    Thanks