Blocking View Source
How do I stop the source code for a page from being visible? Also, what JavaScript can I use that stops someone from right clicking on a page to save a picture?
Thanks,
TonyMontana
How do I stop the source code for a page from being visible? Also, what JavaScript can I use that stops someone from right clicking on a page to save a picture?
Thanks,
TonyMontana
Suzanne posted this at 23:11 — 14th September 2001.
She has: 5,507 posts
Joined: Feb 2000
View source cannot be blocked. However, you can make it non-human readable. It's easy to get around, but some tricks:
1. leave a pile of space at the top of every file (a copyright notice or other comment may be a deterrent as well).
2. use something that scrambles the cases for HTML (will not validate and may fail in newer browsers, not to be used with XML)
3. Remove all hard returns so the code is all one line.
***
No-Right-Click -- just do a search for JavaScript and no right click and you will get oodles of free scripts.
For various reasons, it's pointless and annoying, namely:it's easy to get around (turn off javascript); the images are in the cache anyway; it makes it impossible or annoying for people to use their software as they please; IE6 image bar; blah blah blah, do a search for it in these forums for endless arguments for and against it.
Suzanne
Busy posted this at 23:23 — 14th September 2001.
He has: 6,151 posts
Joined: May 2001
No right click is useless, I know of at least 4 ways around it, plus the ones Suzanne mentioned.
The best way, but this isnt fullproof is to add a watermark to your graphics, like anything in life you cant stop them but you can slow them down.
faults to no right click, say i had a really slow connection one day and went to your site, your site uses graphics for navigation buttons, my connect my be to slow for all of these to load, if you dont have a no right click then we can right click on your image and choose "show picture" but for those that cant get around the no right click then are stuck with no where to go, apart from off your site.
on one of my sites i did as Suzanne mentioned, leave a very large gap (press enter enter enter .... before the first tag) so if you right clicked you'd only see what appears to be a blank page (the scroll bar gives it away that its not) but some people just see the blank page - make it big enough to fit the biggest browsers, its a real pain to edit but i added a fun message at the top so is worth the hassle, message reads: "Ummmm you broke it, I'm telling your mummy on you. Shame on you for stealing other peoples work :Þ"
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.