Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

block viewing of source code

Status
Not open for further replies.
Jun 3, 2005
4
BB
how can I block a user from viewing source code on a html web page
 
Try putting this line at the top of the page:
"DON'T LOOK AT MY SOURCE CODE!!!"

Other than that, don't publish it on the internet.

Other than that, nothing.
 
You can't. You can make it difficult for the user, but there's always a way. People make games out of trying to make it harder, challenging users to find their source code. The savvy users can always find a way.

Now, if you just want to make it difficult for the casual user to find the source code, it'd probably be enough to put your page inside of a frame and disable right-clicking.

However, this is not in the community spirit of the web.

Out of curiosity, why do you care if your users can see the source code?

--Dave

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Shouldn't there be some sort of booby prize for this question? How about the next time it's asked, we all just answer "BOOO!"?

Thomas D. Greer
 
Here's one of the better responses to this question on this board.

--Dave

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Actually there are obfuscator utilities that can help deter the vast vast majority of curious code lookers.

Basically what they do is insert 500 line breaks to make it look empty at first, then use javascript to decrypt contents that appear as encrypted values in the code.

It's criticized as inelegant and it only makes swiping the markup more difficult, but it's worth a mention at least.
 
Here's that fun puzzle I was mentioning before. Give yourself some time to figure it out!

--Dave

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
The main question, posed by LookingForInfo, still remains: Why is your code so freaking special, especially since people like Eric Meyer and similar make no attempt to hide their code.
 
For one thing, it can do things like obfuscate e-mail addresses from spam spiders.

I can see the benefit of hiding source-code in applications, but I agree that it's relatively unimportant on the presentation layer.
 
I think we should have a pool on when is the next time this question will be asked (you KNOW there will be a next time). The person who gets closest to the actual date and time should get US $1 (or whatever) from each of the participants in the pool. Anyone want to start a thread on it?

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Tracy,

it's probably moot. By the time we could organize such a thing, the question will probably have been asked 3 or 4 more times!

:)

--Dave

--Dave

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top