I have a code on my site that and I don't want it to be viewed from source, not because its malicious or anything of that nature, it's just a unique script and I don't want anyone to steal it. Is there anyone to hide this script, maybe have it run within a PHP file?? Any idea I would appreciate.
You can't. If the browser can read the script, anyone else can too. End of discussion. Sorry. (There are only ways to make it harder to get, but you can't make it impossible)
Good read: http://www.webdeveloper.com/forum/showthread.php?t=26841 Also check out the links at the bottom. I wouldn't be so sure. And hiding it will just make things worse:
this may be of use developertutorials.com/tutorials/php/hide-your-javascript-with-php-050419/page1.html except you should check if the session is set instead of the variable as that wouldn't work.
Put the js in a separate file and call it by <script type="text/javascript" src="js/filename.js"></script>. That seems to hide it from the source.
you can use php the stop people from accessing the file and with the unescape/escape functions you can encrypt it hope it helps regards -GK!