hide ajax files
-
hi guys, my site will be using ajax methods and i don't want clientside to view my ajax(js) code when they view the source code of my site.. Does anyone know how i can hide my ajax files so that they are not viewable on clientside? For instance you can import a css file using the @Import command..I tried something similar in javascript with below code:
var script = document.createElement('script');
script.src = '../ajax/login/login.js';
script.type = 'text/javascript';
document.getElementsByTagName('head').item(0).appendChild(script);with the above, none of my methods in the login.js file are loading... Please help me.
-
hi guys, my site will be using ajax methods and i don't want clientside to view my ajax(js) code when they view the source code of my site.. Does anyone know how i can hide my ajax files so that they are not viewable on clientside? For instance you can import a css file using the @Import command..I tried something similar in javascript with below code:
var script = document.createElement('script');
script.src = '../ajax/login/login.js';
script.type = 'text/javascript';
document.getElementsByTagName('head').item(0).appendChild(script);with the above, none of my methods in the login.js file are loading... Please help me.
By definition, a client side file (which your ajxx/javascript files are) are sent to the client. In plain text. So no matter what you do, you cannot stop a determined user from viewing them. You can minify and obfuscate them, but while that may deter an inexperienced user, it won't stop anyone that knows what they are doing. But the question is: why do you want to? Never, ever, put sensitive data in a javascript file.
-
hi guys, my site will be using ajax methods and i don't want clientside to view my ajax(js) code when they view the source code of my site.. Does anyone know how i can hide my ajax files so that they are not viewable on clientside? For instance you can import a css file using the @Import command..I tried something similar in javascript with below code:
var script = document.createElement('script');
script.src = '../ajax/login/login.js';
script.type = 'text/javascript';
document.getElementsByTagName('head').item(0).appendChild(script);with the above, none of my methods in the login.js file are loading... Please help me.
Try using some encryption or obfuscation method to secure your client side javascript.
I Web Development Free Lancer
Share your experience with others Check my Blog... -
hi guys, my site will be using ajax methods and i don't want clientside to view my ajax(js) code when they view the source code of my site.. Does anyone know how i can hide my ajax files so that they are not viewable on clientside? For instance you can import a css file using the @Import command..I tried something similar in javascript with below code:
var script = document.createElement('script');
script.src = '../ajax/login/login.js';
script.type = 'text/javascript';
document.getElementsByTagName('head').item(0).appendChild(script);with the above, none of my methods in the login.js file are loading... Please help me.
In general, you can't hide something from the client if you need the client to use it. My suggestion would be to convert all your js files to aspx files and set the content type. Have them do a referer check and set the caching options to not cache. It won't be good for performance and it won't stop a seriously determined person, but it should be a pretty big speed bump to most people.