Jump to content

Preventing detecting direct access to a file


php_joe

Recommended Posts

I have a JavaScript code on an external file that I'd like to keep private.

 

I know that I can use htaccess to block direct access to the folder, but:

 

1. Will that prevent them from saving the file using "Save As"?

2. Will that prevent the index page from calling it as an external javascript file?

 

Is there any additional methods that I can use to prevent people from viewing or saving an external javascript file?

 

Thanks in advance,

 

Joe

Link to comment
Share on other sites

yes it will prevent the script from being able to call it.. u cant keep javascript private because it is client-side. the browser must have js enabled and be able to interpret it.... you can make it rather obscure if u really want to. best bet is not to put anything in js that you dont want ppl to see.

Link to comment
Share on other sites

I was hoping there was a way in PHP to detect if a file was being accessed directly or was being called from another page on my server.

 

I was also hoping that there was a way to prevent people from using "Save As" to download it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.