Skip to content Skip to sidebar Skip to footer

Serving A File To Javascript

I am required to allow a user to view a file in javascript, but not to able to download the file through a direct link. I understand that using htaccess and changing the permissio

Solution 1:

If you "understand that using htaccess and changing the permissions will not allow this to ever be possible due to the fact that javascript is client side", you should also understand that it's not possible to "allow only the server to access the file, and serve it to javascript via php".

What you are asking is just not possible - if Javascript can access it, the rest of the browser can access it. Javascript does not have more or less privileges than the rest of the visitor's browser, and even if it did he could just enter the relevant Javascript in his debugger console, or in a plugin.

Post a Comment for "Serving A File To Javascript"