freelance84 Posted February 19, 2011 Share Posted February 19, 2011 I was wondering.... Is it possible to protect your JS file? I read somewhere that you could scramble your JS file... but there were no further posts on that. Also i can only assume that a scrambled js file must be unscrambled at some point meaning that the unscramble function will be visible to the user meaning they would know how to unscramble the js file themselves. I read that it is impossible to prevent the user from downloading the js file, is this true? (this link is the discussion) Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 19, 2011 Share Posted February 19, 2011 The only way to prevent your javascript file from being viewed is to not post it on the Internet. ANYTHING that is sent to the browser can be viewed. Quote Link to comment Share on other sites More sharing options...
freelance84 Posted February 19, 2011 Author Share Posted February 19, 2011 Yea i thought so. I have one single function i would like to hide from the user... is absolutely no way of hiding it? Quote Link to comment Share on other sites More sharing options...
.josh Posted February 19, 2011 Share Posted February 19, 2011 you can obfuscate it. Or you can post details about what it does and maybe we can help you come up with a server-side solution instead. Quote Link to comment Share on other sites More sharing options...
freelance84 Posted February 19, 2011 Author Share Posted February 19, 2011 Have you had any experience with any obfuscate programs i particular? Quote Link to comment Share on other sites More sharing options...
freelance84 Posted February 19, 2011 Author Share Posted February 19, 2011 http://www.shaneng.net/Main/JavaScriptObfuscator I found this free JavaScriptObfuscator... however being completely new to the concept... How do you implement the scrambled script to your site? Does it change all the functions names meaning you have to also change all the function names in the html source? Quote Link to comment Share on other sites More sharing options...
Philip Posted February 20, 2011 Share Posted February 20, 2011 Typically JS obfuscation (as with most) with change the variable names and the function names. With JS, I've found obfuscating (or even base64 encoding) can cause errors and typically isn't worth the trouble. Minifying is about as far as I go, even with files for work. For minifying (which can slightly obfuscate a quick read) I typically use http://developer.yahoo.com/yui/compressor/ (or online variants) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.