how to hide my source code so to not be copied
You can do stuff which amounts to security through obscurity, but the only way to prevent your client-side web source from being copyable is to not push it down the wire, to not deliver it in the first place, shut down your website.
Don't do this! It makes no sense to do this, since the user can disable the script, and there are many tools like Firebug by which a user can see the code.
The best way to keep safe the store is installing a security camera while leaving the doors open.
You can simply disable the right click by following:
<body oncontextmenu="return false">
...
</body>
or
<script language="javascript">
document.onmousedown = disableclick;
status = "Right Click Disabled";
Function disableclick(e)
{
if(event.button == 2)
{
alert(status);
return false;
}
}
</script>
The code above is from this article
No, there is no way to hide one's code on the web. If you're sending information to the client-side, that information can be copied. That's not merely a fact of the web, that's a fact of information theory. The only option for cases like this is not prevention, but detection. Many services exist to help in these situations.
Depending on your web host, preventing the listing of files in an images/
directory, for example, may be done by adding an .htaccess
file with appropriate restrictions, or disabling directory listings from within your host's panel. The key words you need are "disabling directory listings". Talk to your webhost's support for more details, this is a very common request, so they likely already know exactly how to help you.
Note that this will only prevent the listing of images in a convenient form. If they are referenced on other pages on your site, they can still be easily downloaded.
Hiding the right click handler only stops honest people from getting the page source and not those using tools like wget or curl. You can obfuscate or minify your JavaScript (such as using Google Closure) but, if the browser needs to get access to the code or content, so can someone who is malicious.
In that case, probably they have an access to your ftp account. If I were you I will change my ftp credentials.
And also, there are tools that would really copy all of the websites content, including its source codes. One notable is IDM or Internet Download Manager http://www.internetdownloadmanager.com/ which has a Site Grabber feature.