Whats the html code that doesnt allows right clicking?

Jaloko

Up-and-Coming Sensation
Joined
Apr 25, 2009
Messages
325
Reaction score
0
FP$
942
Whats the html code that doesnt allows right clicking?

I have an image showcase on my site and I need a code so people cant right click and save the images in the showcase.

Does any one know or have a code for this?
 
It doesnt really work for what Im trying to use it for.

Take a look at the top of my index page you should see a showcase bar
http://gaminglegion.co.cc

I need a code to go around the images. This code isnt ment to go around the images.
Example: <img src=(url here)> I need a code that fits these in between it.
 
Honestly just want to say I wouldn't go through the trouble since the images are already downloaded on their computers when they visit the page, just water mark them. People could always just view the source too
 
I still want it just to stop guests purposley right clicking and saving the images.

It doesnt auto download them on to my computer?
 
Well the images will be saved in your temporary directory until cleared / session over / whatever browser does, so yes they are, same as when you listen to a song on playlist.com for example, an .mp3 is saved to your temp folder
 
Replace your <body> tag with this:

Code:
 <body oncontextmenu="return false;">

Disables users from gaining access to your context menu. So basically it disables the mouse and the keyboard shortcuts from trying to obtain your files on your site. More effective than a Disable Right Click Javascript. ~wink~


But honestly I would like you to read this:

http://www.sitepoint.com/article/dont-d ... ght-click/
 
The Point is theres nothing else in the box but the image urls and image html codes. I'm using a plugin.

I read it and my repsonse is...

Its one showcase box I want right click disabled not the whole index page or whole board just one box at the top of the index page that has scrolling images.

Look:
http://gaminglegion.co.cc


I just added your code before all the images and added </body> at the end it does what I want thanks!

+Rep 🙂

Um.. it doesnt just do it for the box but for the whole index page.....
 
Creativebot said:
Replace your <body> tag with this:

Code:
 <body oncontextmenu="return false;">

Disables users from gaining access to your context menu. So basically it disables the mouse and the keyboard shortcuts from trying to obtain your files on your site. More effective than a Disable Right Click Javascript. ~wink~


But honestly I would like you to read this:

http://www.sitepoint.com/article/dont-d ... ght-click/
Thanks for this !
 
Creativebot said:
Replace your <body> tag with this:

Code:
 <body oncontextmenu="return false;">

Problem is, that method isn't W3C compliant.

If you put this JavaScript anywhere in your after your <body> tag then it will do exactly the same thing, only it's W3C Compliant.
Code:
<script type="text/javascript">
<!--

var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
// --> 
</script>

There is a script that can be used for only disabling right click on images, however as far as I'm aware that doesn't work too well on FireFox 3.
 
You can put it anywhere after <body> and anywhere before </body>.

It will disable right-click over the whole page wherever you put the code.
 
Murder he Wrote said:
Creativebot said:
Replace your <body> tag with this:

Code:
 <body oncontextmenu="return false;">

Problem is, that method isn't W3C compliant.

If you put this JavaScript anywhere in your after your <body> tag then it will do exactly the same thing, only it's W3C Compliant.
Code:
<script type="text/javascript">
<!--

var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
// --> 
</script>

There is a script that can be used for only disabling right click on images, however as far as I'm aware that doesn't work too well on FireFox 3.

Tables are also not compliant anymore either. 😉

And the only end result to this is that if someone needs to get something off your website.....they will do it by any means. And there are so many ways to get it........"View Source" ~rolleyes~
 
Creativebot said:
Tables are also not compliant anymore either. 😉

Yes they are ~lol~
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table cellpadding="0" cellspacing="0">
<tr><td>td 1</td><td>td 2</td></tr>
<tr><td>td 3</td><td>td 4</td></tr>
</table>
</body>
</html>

Put that into W3C's direct-input validator and watch the results ~wink~
 
The problem is I dont want the whole page right click dis-abled just the one little box..
 
Murder he Wrote said:
Creativebot said:
Tables are also not compliant anymore either. 😉

Yes they are ~lol~
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table cellpadding="0" cellspacing="0">
<tr><td>td 1</td><td>td 2</td></tr>
<tr><td>td 3</td><td>td 4</td></tr>
</table>
</body>
</html>

Put that into W3C's direct-input validator and watch the results ~wink~

Thats retarted though. Tables are a cheap way of making a site structure. Thats what float left and right are for with divs. Its more challenging and much more fun to code. Plus tables are old and need to be let go. -n-
 
I couldn't agree more (in terms of creating a page stricture), however since you made the mistake of misleading users into thinking tables aren't W3C Compliant when they are - I thought I should correct you.

Tables are actually very useful when wanting to display, well, a table on your website. Whether it's comparing products, hosting plans or whatever, pure CSS tables are complicated and are no way as easy to knock up as the traditional <table> version.

To say they're "old and need to be let go" is fairly silly in my opinion. In your opinion why should they be let go?
 
I completely agree with MhW here, not to mention it is fact that tables are valid in XHTML 1.0 Strict. What they shouldn't be used for though, is the actual layout of your template. Eg: Instead of using a floating div you use a table to align something, that you should stay away from, but for laying out tabular data tables are just about the only thing that is practical to use.

Also, disabling right click is a pointless method to keep people from stealing content. All I have to do is disable JavaScript and then I can right click till my finger falls off.
 
Back
Top Bottom