View Full Version : How to disable right click of mouse on myspace

08-13-2006, 05:08 PM
Been trying to get a code to work on myspace that disables users from using their right click fucntion to save my stuff. I know it can be done I have found some users who have this function; however myspace blocks the typical code most websites have to disable right clicking.
Any help as to what can be done to make this work

Here is a page no right clicking can be done on



08-13-2006, 07:17 PM
Did you see this code in the source??

var speed = 5

// decrease value to increase speed (must be positive)
// set pause between completion of message and beginning of following message
var pause = 10000

// increase value to increase pause
// set initial values
var timerID = null
var bannerRunning = false

// create array
var ar = new Array()

// assign the strings to the array's elements
ar[0] = "Hello There..."
ar[1] = "Welcome To My Page..."

// assign index of current message
var message = 0

// empty string initialization
var state = ""

// no value is currently being displayed

// stop the banner if it is currently running
function stopBanner() {
// if banner is currently running
if (bannerRunning)
// stop the banner
// timer is now stopped
timerRunning = false

// start the banner
function startBanner() {
// make sure the banner is stopped
// start the banner from the current position

// assign state a string of "0" characters of the length of the current message
function clearState() {
// initialize to empty string
state = ""
// create string of same length containing 0 digits
for (var i = 0; i < ar[message].length; ++i) {
state += "0"

// display the current message
function showBanner() {
// if the current message is done
if (getString()) {
// increment message
// if new message is out of range wrap around to first message
if (ar.length <= message)
message = 0
// new message is first displayed as empty string
// display next character after pause milliseconds
timerID = setTimeout("showBanner()", pause)
else {
// initialize to empty string
var str = ""
// built string to be displayed (only character selected thus far are displayed)
for (var j = 0; j < state.length; ++j) {
str += (state.charAt(j) == "1") ? ar[message].charAt(j) : " "
// partial string is placed in status bar
window.status = str
// add another character after speed milliseconds
timerID = setTimeout("showBanner()", speed)

function getString() {
// set variable to true (it will stay true unless proven otherwise)
var full = true
// set variable to false if a free space is found in string (a not-displayed char)
for (var j = 0; j < state.length; ++j) {
// if character at index j of current message has not been placed in displayed string
if (state.charAt(j) == 0)
full = false
// return true immediately if no space found (avoid infinitive loop later)
if (full) return true
// search for random until free space found (braoken up via break statement)
while (1) {
// a random number (between 0 and state.length - 1 == message.length - 1)
var num = getRandom(ar[message].length)
// if free space found break infinitive loop
if (state.charAt(num) == "0")
// replace the 0 character with 1 character at place found
state = state.substring(0, num) + "1" + state.substring(num + 1, state.length)
// return false because the string was not full (free space was found)
return false

function getRandom(max) {
// create instance of current date
var now = new Date()
// create a random number (good generator)
var num = now.getTime() * now.getSeconds() * Math.random()
// cut random number to value between 0 and max - 1, inclusive
return num % max
// -->

<script language=JavaScript>

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Hey what gives?!";

function clickIE4(){
if (event.button==2){
return false;

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
return false;

if (document.layers){
else if (document.all&&!document.getElementById){

document.oncontextmenu=new Function("alert(message);return false")

// -->

That's how s/he did it. Hey it even uses that script from DD.;)

08-13-2006, 11:36 PM
What if JavaScript was disabled? What if you were using a Pocket PC or an other handheld device, which only has cHTML? There is no reliable way to disable right-click.

08-14-2006, 06:36 AM
mburt: after thinking a little bit on what the OP posted I think he means how to place javascripts in myspace. They don't allow javascript do they??

08-14-2006, 12:40 PM
I'm not really sure.. Ya know, I think that was the original question.. But even if you do find a way to use JavaScript as a I said before, it can be easily avoided.

08-14-2006, 12:47 PM
Yes I agree. If one is an experienced web designer then he never needs any other tools than a good text editor HTML and CSS to make nice websites(even dynamic menus can be made with CSS and HTML).

08-14-2006, 02:49 PM
That code doesnt work either....I'm not after stopping the really smart guys rom getting the stuff I just want to stop the average joe from stealing images and using them elsewhere....from my myspace...
I know myspace isnt a big deal security wise but I would like to keep the average people from saving my pics

Yes myspace diables javascript...whenever you try to place the code it deletes the first bit of it and replaces it with .... on the begining and end of codes. I'm not genius enough to beat this just yet but I'm sure there is a way cause that persons page has it done. So there must be a way to make it work!!!

Any more suggestions as to what to try???

10-22-2009, 02:27 AM
I only made an account to share this wit u guys, I'm amazin' huh? :p Teehee juss playin'... Buh anyway, I found this page cuz someone kept stealin' my boyfriends pictures and it was so annoyin'. I put a new pic up he made for me and ONE of his "fakes" already stole it. So I was like, UGH HOW DO I MAKE IT SO THEY CAN'T SAVE IT!? How do I disable right-click? Bleh, as we all kno, u can't... Buh yea, I found http://chr15.net/myspace/RightClick.php and it worked! I hope this helps cuz it did for me, u can visit my MySpace and see for urself (^_^) I tried to do the clear.gif thing and yea, it didn't work. So have a gr8 day u guys! Let me kno if this helped any! -waves-

10-22-2009, 04:50 AM
If they can see it, they can get it. Right click is not required to copy images. A simple PrtSC, among other methods is all that is required.

10-23-2009, 12:40 AM
If they can see it, they can get it. Right click is not required to copy images. A simple PrtSC, among other methods is all that is required.

Well yea obviously. I knew I shoulda said that in my last message. If someone is THAT desperate to get ur picture then they will. Yea, all they hafta do is Print Screen it. The perfect way to protect ur image and make sure no one else can take it, is to NOT post it at all. Buh yea, if u don't want someone to be able to right click and steal ur picture then the link I gave works perfect. (-_-)

10-23-2009, 01:15 AM
It's not stealing. By posting the picture on a publicly viewable page on the internet, you are effectively giving them the picture.

What you (sub91320) are saying about stopping the "average joe" doesn't hold up, IMO; most people who go around collecting pictures off the internet are well aware they don't need to use right-click.

10-23-2009, 04:01 AM
Most images aren't even worthy of protection. Think about it. Yeah, sure - no one wants their images hijacked. But, at the end of the day, who is really hurt? If you truly suffer any real harm, you can sue or threaten/mention suit to either/both the webmaster and ISP of the site that has hijacked your image(s). In most cases, this is all that is required to have them remove your images from the site. If there is significant harm and the above mentioned brings no relief, you can actually sue. At that point (significant harm), it would be worth the trouble.

Even before it gets to any of that, depending upon the issues involved, you can always simply publish lower res or watermarked versions. it really depends upon what you are trying to protect.

Also, before you worry about any of the above, make sure you have exclusive rights to the image. For instance - if it is of a public person, said person often already has rights to their own image. If the image was obtained in a particular venue (like a festival or park), said venue may already have rights.

Getting back to the idea of preventing right click - If it makes you happy, OK. But be aware that any script added to your page increases the chance of conflicts with other scripts, and/or issues in at least some browsers, and increased load/functional time in most browsers. In my opinion, such scripts are therefore worthless at best.