Is there anyway you can stop people viewing your source code in there browsers? by that i mean im building a website and im spending alot of time on it and i dont want people to take bits and pieces from it.i'm kind of answering my own question here by saying no you cant but maybe someone else has a different view?
Encrypting your code in hexadecimal strings using javascript would be the only solution that guarantees a certain level of obscurity, but that slows the site awfully. If your code is really revolutionary and you don't want to have others using it, why don't you patent it? Otherwise, I see no point in hiding it, it's public anyway.
if it is client side javascript, HTML, etc. the answer is no. the only thing you can attempt is obfuscation as mentioned by Elia. I believe using flash makes things a bit harder too, but haven't tried.
No you can not. I understand you spend a lot of time on building it but is the html/javascript code so special ?
You are missing the basic point. Anything you send to the client application, can be seen by anyone. Even if you do some silly tricks to make a browser hide it, I can write an HTTP client that mimics a browser and make it display all the content, in couple of minutes. All that connects to your server give user agent similar to a browser need not be a browser at all. Anything you send to a browser will be readable to any HTTP client and so, to anyone who can connect to your server. This eagerness to hide HTML source remind me of early dotcom days. People understand the basics now and such questions are rare. My advice is - stop giving too much importance to yourself and stop believing that people are out to fetch your smart code. Web doesn't work that way. If you are able to do something great, you will succeed. Copycats rarely overtake originals and first over advantage is very important. Spend your time and effort on creative thinking and avoid paranoia.
You can use javascript to make it harder for them to view it. But there is no way to stop a determined person from seeing your front end code unless you are using actionscript/flash.
Although Encryption is the way todo it, but if you will use such thing then its also possible that it become difficult for Google crawler to find you. So there is no need todo it.