By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,680 Members | 1,868 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,680 IT Pros & Developers. It's quick & easy.

writing an html command to disable the right click>view source option

P: n/a
How do you disable the right click>view source option on web pages so people
can't view your coding and copy it? What's the html I need to include in my
website to utilize this feature?

Thank you.
Jul 23 '05 #1
Share this Question
Share on Google+
29 Replies


P: n/a


lori3laz wrote:
How do you disable the right click>view source option on web pages so people
can't view your coding and copy it? What's the html I need to include in my
website to utilize this feature?


<img src="website.png" alt="my web site" width="800" height="600">

SCNR

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

P: n/a
On 01 Nov 2004 13:58:12 GMT, lori3laz <lo******@aol.com> wrote:
How do you disable the right click>view source option on web pages so
people can't view your coding and copy it? What's the html I need to
include in my website to utilize this feature?


You can't. Besides:

1) That's not the only way to view the source.
2) Seeing as the user already has downloaded your page (they couldn't view
it otherwise), how do you propose you stop them from looking at its source?

Finally, what's so special that no-one should see your code?

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #3

P: n/a

"lori3laz" <lo******@aol.com> wrote in message
news:20***************************@mb-m29.aol.com...
How do you disable the right click>view source option on web pages so people can't view your coding and copy it? What's the html I need to include in my website to utilize this feature?


Even if you could do that, would you be satisfied when they choose View
Source from their browser's menu?

Jul 23 '05 #4

P: n/a
On 01 Nov 2004 13:58:12 GMT, lori3laz <lo******@aol.com> wrote:
How do you disable the right click>view source option on web pages so
people
can't view your coding and copy it? What's the html I need to include
in my
website to utilize this feature?


http://www.vortex-webdesign.com/help/hidesource.htm
Jul 23 '05 #5

P: n/a
lori3laz wrote:
How do you disable the right click>view source option


You don't. In fact, HTML is a markup language; there are no commands to
do anything. But not to worry: it is doubtful that you have any HTML
code worth stealing.

--
Brian (remove "invalid" to email me)
Jul 23 '05 #6

P: n/a
On 01 Nov 2004 13:58:12 GMT, lo******@aol.com (lori3laz) wrote:
How do you disable the right click>view source option on web pages so people
can't view your coding and copy it? ...


Troll.

--
Rex
Jul 23 '05 #7

P: n/a
In article <41***********************@newsread2.arcor-online.net>,
Martin Honnen <ma*******@yahoo.de> wrote:
How do you disable the right click>view source option on web pages so people
can't view your coding and copy it? What's the html I need to include in my
website to utilize this feature?


<img src="website.png" alt="my web site" width="800" height="600">

SCNR


That's nasty: giving him something that doesn't work AND increases his
bandwidth bill.

--
Kris
<kr*******@xs4all.netherlands> (nl)
Jul 23 '05 #8

P: n/a
"lori3laz" <lo******@aol.com> wrote in
comp.infosystems.www.authoring.html:
How do you disable the right click>view source option on web pages so people
can't view your coding and copy it?
Here we go again!

Brown's Law: The need to protect someone's precious HTML coding is
inversely proportional to their desire to protect it.
What's the html I need to include in my
website to utilize this feature?


What's the HTML you need to cause an automobile to rise unsupported
100 meters in the air?
In other words: You can't do this, and there's no reason on god's
green earth why you should want to. Trust me, your code isn't that
precious. (Neither is mine, or anyone else's.)

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Jul 23 '05 #9

P: n/a
begin quote from lori3laz in
<20***************************@mb-m29.aol.com>:
How do you disable the right click>view source option on web pages so
people can't view your coding and copy it? What's the html I need to
include in my website to utilize this feature?


Remove it from the server and never put it up again. There's no way to do
this in HTML, and for future reference HTML does not have commands because
it is not a programming language.

Once you learn more about authoring HTML for the Web you'll realize just how
silly this question is that you just asked.

--
Shawn K. Quinn
Jul 23 '05 #10

P: n/a
lo******@aol.com (lori3laz) wrote in
news:20***************************@mb-m29.aol.com:
How do you disable the right click>view source option on
web pages so people can't view your coding and copy it?
What's the html I need to include in my website to utilize
this feature?

Thank you.


While it is the case that you can never totally prevent
people who know how from viewing your code, there are ways
that you can use to make it less easy..

First, you need to control the context menu, I'd recommend
http://www.usingit.com/products/js/menu/jcm/

===
Javascript ContextMenu 1.0

Javascript ContextMenu is a powerful Javascript-producing
design tool for creating context menu on web pages. The menu
will replace the default context menu of the web browser. It
will appear if user right-click the mouse on the web browser
window.
===

Second you need to open your page in a chromeless window,
that is, a window without the usual menu.. For this I'd look
at
http://www.dynamicdrive.com/dynamici...chromeless.htm

===
A chromeless window is a special type of window stripped of
the conventional interface, such as titlebar, browser
buttons, status bar etc (aka chrome). This allows you to
implement your own chrome, from how the title bar should
look, the buttons to display (ie: close, max), to whether to
render a border. In other words, complete control over the
window's look
===

KHaled.

===
e-mail: khaledihREMOVEUPPERCASELETTERS at fusemail dot net
(correcting antispam crap..)
Please add the text "==NG==" in the Subj: field.
Jul 23 '05 #11

P: n/a
KHaled wrote:
lo******@aol.com (lori3laz) wrote in
news:20***************************@mb-m29.aol.com:

How do you disable the right click>view source option on
web pages so people can't view your coding

As I'm sure many people have told you already, you don't!
While it is the case that you can never totally prevent
people who know how from viewing your code, there are ways
that you can use to make it less easy..
Which is exactly why you shouldn't. You do not have any right
whatsoever to control your visitors application window. You have the
power of suggestion over the contents of the viewport — you control the
content and the default presentation. You do not control the size of my
window, whether or not I have toolbars and menus, the status bar, and
you should not control when I open a new window. These are all part of
my application, not yours. I am the one browsing the web page, not you,
so why on earth do you want to control the way I do so? There is *no*
valid reason for doing so, it only serves to make your site more
annoying and less usable.
First, you need to control the context menu, I'd recommend
http://www.usingit.com/products/js/menu/jcm/

Second you need to open your page in a chromeless window,
that is, a window without the usual menu.. For this I'd look
at
http://www.dynamicdrive.com/dynamici...chromeless.htm


Hiding the menus and toolbars and blocking the context menu prevents me
perfoming valuable functions like using the back button (though luckily,
I have one availble on my mouse), reloading the page, bookmarking the
page, selecting "translate this page" from my googlebar, adding a user
stylesheet using Web Developer, disabling page colours, increasing text
size (if I didn't know the keyboard shortcut) and countless other
functions I, or anyone else may use on a daily basis.

Also, opening your site in a new window makes unreasonable assumptions
about my preferences for my window size. I don't like having browser
windows maximized, I don't like having tiny little boxes, I like having
*my window* at the size I make it, and you have no right to force me to
change it! If you design your site correctly, and make the layout fluid
enough, then it should not matter what size *my window* is. I'm the one
viewing it, so I am in control of how I view it, NOT YOU!

Lastly, making a window "chromeless" is dangerous, especially in IE
(before SP2) because it has the ability to hide the title bar. This
provides valuable accessibility functions, like providing the title of
the page, and the name of the application, and it also provides my
minimise, maximise and close buttons. Although, in the demonstration
provided, these were added using images, they did not match my system
settings. They were a lot smaller, and failed to look like my close
buttons. You don't know, but I may have poor vision and have my system
set up to make those min, max and close buttons twice as big as default,
to help me target them with the cursor, and they may have high
contrasting colours to help me see them. None of those features are
provided by the replacement buttons provided in the demonstration.l

Not only that, but having experienced many sites that abuse that system,
I'm reluctant to use such buttons, out of fear of them performing
unexpected behaviours. If you provide them, it means you have provided
their function. Thus, it is possible for you to do anything but close
my window. Thankfully, SP2 solved that problem and no longer allows IE
windows to hide the title bar, and descent browsers like Firefox give me
advanced control over scripting, but many users aren't as skilled as I,
and will only get confused by your efforts.

So, in conclusion, you *DO NOT* control my application, I DO!

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://SpreadFirefox.com/ Igniting the Web
Jul 23 '05 #12

P: n/a
On Fri, 5 Nov 2004, KHaled wrote:
While it is the case that you can never totally prevent
people who know how from viewing your code, there are ways
that you can use to make it less easy..
Basically what you are saying are that those who have no interest in
the source and wouldn't know what to do with it if they got it, can be
hindered from seeing it, but anyone who really cared would still have
no real problem. So: why bother?
First, you need to control the context menu,


Lesson #1 of the WWW: once it's left your server, YOU DO NOT
CONTROL ANYTHING.

Jul 23 '05 #13

P: n/a
lori3laz wrote:
How do you disable the right click>view source option on web pages so people
can't view your coding and copy it? What's the html I need to include in my
website to utilize this feature?


Well, you can't do that, but you can do the next best thing.
Configuring your server to send any one of these HTTP Status codes for
the HTML documents you need to protect should work well for you:

401 Unauthorized
403 Forbidden
404 Not Found
410 Gone

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://SpreadFirefox.com/ Igniting the Web
Jul 23 '05 #14

P: n/a
On 5 Nov 2004 09:16:00 GMT, KHaled <me@localhost.home> wrote:
While it is the case that you can never totally prevent
people who know how from viewing your code, there are ways
that you can use to make it less easy..


But it's an utterly pointless exercise. Those who really could benefit
from your code will easily get around this, those who don't care get
decreased usability and annoying little windows popping up. It hurts
rather than helps.
Jul 23 '05 #15

P: n/a
begin quote from KHaled in <Xn*****************************@130.133.1.4>:
First, you need to control the context menu, I'd recommend
http://www.usingit.com/products/js/menu/jcm/

===
Javascript ContextMenu 1.0

Javascript*ContextMenu*is*a*powerful*Javascript-producing
design tool for creating context menu on web pages. The menu
will replace the default context menu of the web browser. It
will appear if user right-click the mouse on the web browser
window.
===
And this will not do anything with Javascript disabled. Even with Javascript
enabled, it's quite possible to use the menus to view source anyway.

Besides, once it's left the server, you don't control jack shit.
Second you need to open your page in a chromeless window,
that is, a window without the usual menu.. For this I'd look
at
http://www.dynamicdrive.com/dynamici...chromeless.htm

===
A chromeless window is a special type of window stripped of
the conventional interface, such as titlebar, browser
buttons, status bar etc (aka chrome). This allows you to
implement your**own*chrome,*from*how*the*title*bar*should
look, the buttons to display (ie: close, max), to whether to
render a border. In other words, complete control over the
window's look
===


First, I can get my toolbars back quite easily (control-M in my browser).

Second, it's rude to your users to assume they want a page in a new window,
or to attempt to saddle them with one when you know damn well they don't.

Third, once it has left your server, you don't control jack shit.

--
Shawn K. Quinn
Jul 23 '05 #16

P: n/a
Shawn K. Quinn wrote:
Third, once it has left your server, you don't control jack shit.


http://home.rochester.rr.com/bshagna...s/jackshit.jpg

:-)
--
-bts
-This space intentionally left blank.
Jul 23 '05 #17

P: n/a
http://www.deltascripts.com will have a small java code you can use to
disable right-click.

http://www.sourceguardian.com will have a program to help you encrypt your
code.

..

"Stan Brown" <th************@fastmail.fm> wrote in message
news:MP************************@news.odyssey.net.. .
"lori3laz" <lo******@aol.com> wrote in
comp.infosystems.www.authoring.html:
How do you disable the right click>view source option on web pages so peoplecan't view your coding and copy it?


Here we go again!

Brown's Law: The need to protect someone's precious HTML coding is
inversely proportional to their desire to protect it.
What's the html I need to include in my
website to utilize this feature?


What's the HTML you need to cause an automobile to rise unsupported
100 meters in the air?
In other words: You can't do this, and there's no reason on god's
green earth why you should want to. Trust me, your code isn't that
precious. (Neither is mine, or anyone else's.)

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/

Jul 23 '05 #18

P: n/a
SwampRat gave this terrific advice:
http://www.deltascripts.com will have a small java code you can use
to disable right-click.
PHP applications, no 'java' code. "DeltaScripts has specialized in
programming with MySql and php, ... "
http://www.sourceguardian.com will have a program to help you
encrypt your code.


...for encrypting php scripts and it is $250.00 USD.
Please don't top-post.

--
-bts
-This space intentionally left blank.
Jul 23 '05 #19

P: n/a
"SwampRat" <as************@hotmail.com> wrote in
comp.infosystems.www.authoring.html:
http://www.deltascripts.com will have a small java code you can use to
disable right-click.

http://www.sourceguardian.com will have a program to help you encrypt your
code.


Thanks for posting upside down _and_ quoting the entirety of the
previous article without actually responding to it. That saves us
time by letting us know not to take seriously anything you say.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Jul 23 '05 #20

P: n/a
I am sorry.. I did not think that my technical suggestions had
moral or ethical implications.. Perhaps if you feel that your
liberties have been infrineged then you should simply close the
window. Simple really.

Jul 23 '05 #21

P: n/a
On 6 Nov 2004 20:36:33 GMT, KHaled <me@localhost.home> wrote:
I am sorry.. I did not think that my technical suggestions had
moral or ethical implications.. Perhaps if you feel that your
liberties have been infrineged then you should simply close the
window. Simple really.


By then the offense has been made.

If you feel your liberties have been infringed by having your car stolen,
then you should simply get another car.

Jul 23 '05 #22

P: n/a
begin quote from KHaled in <Xn*****************************@130.133.1.4>:
I am sorry.. I did not think that my technical suggestions had
moral or ethical implications.. Perhaps if you feel that your
liberties have been infrineged then you should simply close the
window.**Simple*really.


Believe me, we will, and it will be your loss. Chances are that your
competitors do not have the same desire to be control freaks.

--
Shawn K. Quinn
Jul 23 '05 #23

P: n/a
"KHaled" <me@localhost.home> wrote in
comp.infosystems.www.authoring.html:
I am sorry.. I did not think that my technical suggestions had
moral or ethical implications.. Perhaps if you feel that your
liberties have been infrineged then you should simply close the
window. Simple really.


Are you really not able to understand the problem? Let me try it in
words of one syllable:

What you want to do will piss off the folks who come to your site.
When you piss people off on the Web, they leave and don't come back.
Is that what you want?

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Jul 23 '05 #24

P: n/a
Quoth the raven Stan Brown:
Are you really not able to understand the problem? Let me try it in
words of one syllable:

What you want to do will piss off the folks who come to your site.
When you piss people off on the Web, they leave and don't come
back. Is that what you want?


People has two syllables. Please try again.

--
-bts
-This space intentionally left suggesting "them" ?
Jul 23 '05 #25

P: n/a
"Beauregard T. Shagnasty" <a.*********@example.invalid> wrote in
comp.infosystems.www.authoring.html:
Quoth the raven Stan Brown:
Are you really not able to understand the problem? Let me try it in
words of one syllable:

What you want to do will piss off the folks who come to your site.
When you piss people off on the Web, they leave and don't come
back. Is that what you want?


People has two syllables. Please try again.


Dang! I edited the first "people" to "folks", but missed the second!

:-)

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Jul 23 '05 #26

P: n/a
My post was a response to a poster, and cover aspects from a
technical point, after a forewarning about the impracticality of
this. Personally when I use such methods it is with the intent
of enhancing the browsing experience of a visitor, and not a
matter of control. My focus is on the user interaction.
However, I now see that there are strong feelings about this,
and I will be a little more sensitive when I do things like
that..

KHaled.

===
e-mail: khaledihREMOVEUPPERCASELETTERS at fusemail dot net
(correcting antispam crap..)
Jul 23 '05 #27

P: n/a
KHaled <me@localhost.home> wrote:
My post was a response to a poster, and cover aspects from a
technical point, after a forewarning about the impracticality of
this. Personally when I use such methods it is with the intent
of enhancing the browsing experience of a visitor, and not a
matter of control.


Consider it this way: When a user interacts with an application and
the usual response isn't received, it confuses the user and causes him
to worry that something is broken. If the user realizes that he is
being prevented deliberately from using functions he expects to have
at his disposal, he becomes annoyed. Confusion, worry, and annoyance
are not usually thought of as "enhancements" to the user experience.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 23 '05 #28

P: n/a
Harlan Messinger <hm*******************@comcast.net> wrote in
news:52********************************@4ax.com:
KHaled <me@localhost.home> wrote:
My post was a response to a poster, and cover aspects from
a technical point, after a forewarning about the
impracticality of this. Personally when I use such methods
it is with the intent of enhancing the browsing experience
of a visitor, and not a matter of control.


Consider it this way: When a user interacts with an
application and the usual response isn't received, it
confuses the user and causes him to worry that something is
broken. If the user realizes that he is being prevented
deliberately from using functions he expects to have at his
disposal, he becomes annoyed. Confusion, worry, and
annoyance are not usually thought of as "enhancements" to
the user experience.


The point is well taken, my thinking is based on my
background in developing instructional resources. In this
context an element of control and direction of the user
interaction is required. Extrapolating from that, if the
user is a newbie then they would probably benefit more by a
little guidance/help. If on the other hand they are
proficient, then they will be able to control their own
viewing experience.

I guess what I'm getting from this discussion is that
guidance rather than control is a better option.
Interesting.

Regards,
KHaled.

===
e-mail: khaledihREMOVEUPPERCASELETTERS at fusemail dot net
(correcting antispam crap..)
Jul 23 '05 #29

P: n/a
On 8 Nov 2004 08:27:35 GMT, KHaled <me@localhost.home> wrote:
I guess what I'm getting from this discussion is that
guidance rather than control is a better option.
Interesting.


If that's what you're getting, it's a credit to our ability to explain and
your ability to comprehend. That's exactly it. Because of the myriad of
possible factors affecting rendering, control on the WWW is impossible,
and attepts to control will eventually fail.
Jul 23 '05 #30

This discussion thread is closed

Replies have been disabled for this discussion.