I want to hide json file from public access. How do I do that? I want to hide json file from public access. How do I do that? json json

I want to hide json file from public access. How do I do that?


Javascript running at client side, so your visitor can get any resource used by javascript.If you want to hide anything, you need to replace your javascript code by server-side generation.


You cannot protect json data. If the public cannot access the data then your page also cannot access it.


You can check ip of requester at the top of your json fileif it's not your server then exit

This is example

if($_SERVER['REMOTE_ADDR'] != '190.180.0.1')exit ('You can not use this file');

and sure you have to replace ip with your server ip

i missed this part (and the javascript file is loading )

sure the above code will no't work because java script is client sideso if you blocked all requests except your server then your users also can't load this file