Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Disabling right click on clickthrough urls


D1whitman

Question

I used code injection to disable right clicks on my photos on my site.  It works on images on the pages, and even on lightboxes of images.  However, I have some gallery pages where clicking on the photo will open it in a new window for the viewer (using clickthrough URL to a jpg file).   But that new window allows the image to be right clicked and saved by viewers, which I am trying to avoid.   Does anyone know where/how to inject the code on these new windows?

Edited by D1whitman
Link to post
  • Answers 5
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

5 answers to this question

Recommended Posts

  • 0

Which code did you use? I guess you can exclude some class name in your code.

You can send your question to my email to get faster answer.

How to:

-- I'm off in Lunar New Year. Will take 3-7 days to you get the answer on Forum.

Link to post
  • 0

Hi Tuan,

I used the following as a Code Injection in Tremont, so I guess it goes to the header of each page:

<script language=JavaScript> var message="Function Disabled!"; function clickeIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function("alert(message);return false") </script>

It works perfectly, except for an image that is set to open in a new browser tab.

There is a workaround, where instead of opening a jpg image in a new tab on clickthrough, I could link the image to open to a new page, then create a new page myself and put the disable right click code on that page specifically.  That will be time-consuming though and I thought maybe there is a quicker mechanism.  I don't know how to code, though, these are things I've picked up from Google (or your website, which is helpful).  

 

 

Link to post
  • 0
4 minutes ago, D1whitman said:

Hi Tuan,

I used the following as a Code Injection in Tremont, so I guess it goes to the header of each page:

<script language=JavaScript> var message="Function Disabled!"; function clickeIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function("alert(message);return false") </script>

It works perfectly, except for an image that is set to open in a new browser tab.

There is a workaround, where instead of opening a jpg image in a new tab on clickthrough, I could link the image to open to a new page, then create a new page myself and put the disable right click code on that page specifically.  That will be time-consuming though and I thought maybe there is a quicker mechanism.  I don't know how to code, though, these are things I've picked up from Google (or your website, which is helpful).  

 

 

If you used code from this post, you can exlude some page, above code I'm not familiar

 

You can send your question to my email to get faster answer.

How to:

-- I'm off in Lunar New Year. Will take 3-7 days to you get the answer on Forum.

Link to post
  • 0

Thanks for the post.  I still have the same issue though.  It works perfectly, but if you set an to open in a new browser window  or tab (as opposed to a lightbox, for example), then someone can one again right click on the image in that new window/tab.  They cannot do so on the original index or image page or gallery page, but they can if it opens in a new window.  I don't want to exclude it.  I want to include that new window/tab as an area where it disables right clicks.  I might just have to make the clickthrough link to a new image page instead of just to a .jpg file.  On a brand new page, I can enter CSS code injections, but I don't know how to do that when the clickthrough is set to open a .jpg file.

Link to post
  • 0
37 minutes ago, D1whitman said:

Thanks for the post.  I still have the same issue though.  It works perfectly, but if you set an to open in a new browser window  or tab (as opposed to a lightbox, for example), then someone can one again right click on the image in that new window/tab.  They cannot do so on the original index or image page or gallery page, but they can if it opens in a new window.  I don't want to exclude it.  I want to include that new window/tab as an area where it disables right clicks.  I might just have to make the clickthrough link to a new image page instead of just to a .jpg file.  On a brand new page, I can enter CSS code injections, but I don't know how to do that when the clickthrough is set to open a .jpg file.

Can you share link to your site?

 

You can send your question to my email to get faster answer.

How to:

-- I'm off in Lunar New Year. Will take 3-7 days to you get the answer on Forum.

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...