I have been developing JavaScript code for one of my new website projects. It is very VERY important that my quoting algorithm is kept out of my competitions hands as this will set me apart from almost all my competition. Is there a way I can protect my JavaScript code?
or you can use ajax. Put all your algorithm in a PHP file, then call it using javascript. I think it is the best way to protect your script.
If it is javascript then it has to be sent to the client and their browser must be able to interprit it and so cannot be hidden from them. The only way to truly hide it is to have the calculation done server side with .Net/ PHP/ JSP etc as that way the algorithm is never sent to them... you can use AJAX to get a smoother process if that is important to you.
You could just write the code in php and include that on your webpage instead of including the javascript. This way the algorithm wouldn't be displayed as it would be parsed server side, and the results would be fed to the browser with a simple echo statement at the end. Pretty much what's already been said.