Jump to content

how to block right-click on my site


Recommended Posts

  • 2 months later...

These scripts would most probably be written in JavaScript so this method isn't exactly idiot proof. Though, I say that but idiots may not be able to work it out...

If someone decides to disable their browser's JavaScript then they would be able to use the right-click function on your website, if somebody really wanted something from your website, they would view the page source and cope & paste whatever they want from there or copy the image URL or whatever it is that they want.

Also, some of these scripts don't work on older browsers.

This is something that you're looking for but it may not be exactly what you're looking for but it could be worth a try.

It needs to be placed inside your HEAD tags. ( < HEAD > and < / HEAD > )

<script LANGUAGE="JavaScript">
<!-- Disable
function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")
document.oncontextmenu=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
//-->
</script>

I found this on one of the websites from a Google search:

Disable Right-Click Function on Website

Take a look through some of them. You should find what you need sooner or later.

Link to comment
Share on other sites

  • 1 year later...
  • 5 months later...

You can use

"<script type=”text/javascript”>

function clearData(){

window.clipboardData.setData(’text’,”);

}

function ccb(){

if(clipboardData){

clipboardData.clearData();

}

}

setInterval(”ccb()”, 1000);

</script>"

in the header section.

In the body

"onload=”ccb()” onbeforeprint=”return false” onprint=”return false” onbeforecopy=”return false” oncopy=”return false” onbeforecut=”return false” oncut=”return false”>"

Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...
  • 9 months later...
  • 8 months later...

Yes, it can be done in HTML by adding a JavaScript code. All what you need is to place in the following code in the head of your HTML document, between the <HEAD></HEAD> tags.

<SCRIPT LANGUAGE="JavaScript">
<!-- Disable
function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")
document.oncontextmenu=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
//-->
</script>

Link to comment
Share on other sites

I

Yes, it can be done in HTML by adding a JavaScript code. All what you need is to place in the following code in the head of your HTML document, between the <HEAD></HEAD> tags.

<SCRIPT LANGUAGE="JavaScript">
<!-- Disable
function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")
document.oncontextmenu=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
//-->
</script>

I suggest that you check the date of this thread, you are wasting your time replying.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy