View Full Version : Disable Vew Source


bbing
07-14-2003, 06:43 PM
hey~ i didn't know if this code was HTML or Javascript so sorry~ ^^;;; well um..is there any code that "disables" view source? like...if you click on it, nothing will happen or the source will be shown as empty...do you understand? please help~ thanks! =]

Dude128
07-14-2003, 06:51 PM
there is no way to completely block the source code. however, there are many ways to annoy visitors. these methods usually use the disguise of being source blockers.

you could use a no right click script.
problem- they're annoying- there are some useful things on the right click menu, and alerts are really annoying.
way around- click View> Source in the toolbar

source code scramblers.
problem- you didn't invent HTML- so what if someone wants to see how you did something so s/he can learn? if someone just wants to see how to make a mailto link, they should be able to, since you didn't invent that code, for example
way around- easily descrambled. just do a find and replace on each of the character codes it substitutes for things like the <, >, etc. usually you can figure out what's what from the context in which it's used

HTML comments at the beginning of the file, followed by a number of new lines.
problem- only prevents the people that don't realize they can just scroll down to see the code from getting it
way around- scroll down

Alcy
07-15-2003, 01:19 AM
It's not 100%, but you could put your entire page inside a frameset, and use this (http://www.echoecho.com/jsfra) javascript to redirect the page back to the frameset should it ever be loaded outside of it.

If someone views the source, all they'll get is the code for the frames.

bbing
07-15-2003, 05:39 AM
thanks a lot for your help! =]