Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsGalleryGalleryTo Disable Right Click and Image ToolbarTo Disable Right Click and Image Toolbar
Previous
 
Next
New Post
2/3/2006 9:50 AM
 

There are many instances where people would like to use a gallery but don't want site visitors to be able to "take" the images. Now realize, there is simply so sure foolproof way to prevent image stealing. If you don't want your images taken off a website, there is only 1 sure thing to do that: don't put the image on a website.

However, it can be made so that its not easy and that you really have to know what you're doing. Couple steps are easy in DNN Gallery.  Disable the Internet Explorer "Image Toolbar".  Thats the small toolbar that appears (by default) when you hover over a large image. It allows easy "saving" and emailing. The other is to disable the "Right Click" menu which gives access to the "Save Picture As". Here is code to do both.  Perhaps the Gallery could have a configuration option to employ this or not.  My solution here employs it unconditionally.  My solution also only works on the "popup" version, not the ASCX version.  If the ASCX version is configured (do not "Allow Popup") its harder to prevent image stealing since user can have a IE menu, can "View Source" and find the <img> tag.

In files: /DesktopModules/Gallery/Slideshow.aspx  and /DesktopModules/Gallery/Viewer.aspx (does not require a recompile of source, can be done in the install version only)

Add code to HTML view:

 <HEAD>
  <title>Gallery Viewer</title>
  <meta HTTP-EQUIV="imagetoolbar" CONTENT="no"> <!-- NEW CODE to prevent IE Image toolbar -->
  (more stuff)
 </HEAD>
 <BODY>
  <!-- remove "DesktopModules/Gallery/" from path and add type attribute -->
  <script language="javascript" type="text/javascript" src='<%= Page.ResolveUrl("Popup/gallerypopup.js") %>'></script>    
  <!-- NEW CODE. prevent right click -->
  <script language="JavaScript" type="text/javascript">
  // Set the message for the Right-Click alert box
  am = "Content is copyrighted. Right click is disabled.";
  // ===========================
  bV  = parseInt(navigator.appVersion)
  bNS = navigator.appName=="Netscape"
  bIE = navigator.appName=="Microsoft Internet Explorer"

  function nrc(e) {
     if (bNS && e.which > 1){
        alert(am)
        return false
     } else if (bIE && (event.button >1)) {
       alert(am)
       return false;
     }
  }
  document.onmousedown = nrc;
  if (document.layers) window.captureEvents(Event.MOUSEDOWN);
  if (bNS && bV<5) window.onmousedown = nrc;
  </script>

 
New Post
2/3/2006 9:00 PM
 

I added this as an enhancement in Gemini, not sure when it will surface yet.

 


Chris Paterra

Get direct answers to your questions in the Community Exchange.
 
New Post
2/3/2006 10:54 PM
 

One very nice thing I've noticed about using the popup window to display your photos is that people linking your photo from their site drops down to nearly zero.  I suppose that it takes more dedication than the kids at mySpace have to figure out the link. :)

Google results are a little strange but I only seem to have increased my ranking on the sites that use the popup.  On sites not using the popup I get general exceptions from an incorrect tabid.  They indexed the photos and I subcequently moved the page the module was on. 

I got rid of the GE by changing the way the datacache.getcache  function was being checked.


Paul Davis
 
New Post
2/4/2006 12:50 AM
 

Yes, using the popup window setting, by itself, makes it more difficult to access the raw image.  There is no address bar to see the URL, no menu to "View > Source". So, by disabling right click, you take away the last "easy" method.  There is another code snippet to disable right click, but its specific to IE:
another <HEAD> tag:
document.oncontextmenu = function(){return false} or something like that.

Of course, these are defeated by a user by disabling Javascript, but then they can't get the popup. They can always right click on a thumbnail and determine its path and they figure out path of the _source or resized version.

A downside to the popup is that many cellphone browsers have weak support or none for javascript, so the gallery doesnt work for them.

There are other techniques that can be used. One is display image as a background of a cell and have a "clear" jpg be the <img> tag such as:

  <tr>
  <td background="myimage.jpg">
  <img src="transparent.gif" width="100" height="50">
  </td>
  </tr>
 and to do this in CSS file makes it even more obscure. The key is that its "obscure", not impossible to get the image. The only way to prevent that is to save the image as a myimage.resources file, then stream it out as JPG file upon demand. This cuts into page speed.

I believe there is also a way to configure the webserver (IIS) to deny the file or deliver an alternate file ("stop stealing my bandwidth!!") if the HTTP request is not coming from the same server. I don't know how to do this, perhaps its a HTTPModule type thing or advanced IIS setting. If this were known, then having a MySpace.com user set an image off of the site as their background would be halted.

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsGalleryGalleryTo Disable Right Click and Image ToolbarTo Disable Right Click and Image Toolbar


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out