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) Link to comment https://forums.phpfreaks.com/topic/228217-prevent-the-user-from-viewing-the-js-file/ 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. Link to comment https://forums.phpfreaks.com/topic/228217-prevent-the-user-from-viewing-the-js-file/#findComment-1176858 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? Link to comment https://forums.phpfreaks.com/topic/228217-prevent-the-user-from-viewing-the-js-file/#findComment-1176861 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. Link to comment https://forums.phpfreaks.com/topic/228217-prevent-the-user-from-viewing-the-js-file/#findComment-1176862 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? Link to comment https://forums.phpfreaks.com/topic/228217-prevent-the-user-from-viewing-the-js-file/#findComment-1176864 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? Link to comment https://forums.phpfreaks.com/topic/228217-prevent-the-user-from-viewing-the-js-file/#findComment-1176884 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) Link to comment https://forums.phpfreaks.com/topic/228217-prevent-the-user-from-viewing-the-js-file/#findComment-1177075 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.