Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do i prevent downloading of pictures on a page

Mark Nixon July 17, 2011

Hi,

I wish to add a photo/picture/diagram/whatever to a confluence page, however I wish to protect it to stop people from right clicking and saving the photo. I know there are ways around this, however we just need a simple solution to help prevent distribution of out-of-date photos and diagrams.

I have seen it done on websites in the past - can it be done in Confluence??

Thanks

Mark

4 answers

1 accepted

2 votes
Answer accepted
Jim Birch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 18, 2011

There's no perfect method. If you can see it, your browser has already downloaded it, so it's somewherre in the cache or accessible via the image url. A smart user can find it. All you can do is foul up the R-Click/SaveAs. It's almost alway possible to create a screenshot, except with very elaborate stuff like converting the image to a Flash effect.

1. Disable right click with javascript, or pop up a message saying "please don't download content will be updated. This will annoy users who use r-click for other things.

2. Create a macro that displays the image with a 100% transparent overlay. I think you'll need to include pixel size in the macro, which is messy. R-Click/Save will save the overlay not the image. However, the user can still search their cache or take a screenshot to get the pick. You could muck around with transparency and mouseover something to degrade the screenshot or swap the image on r-click. It's still in cache.

3. Place a caption "Please don't download, use a link for the latest version under the pic. People will be able to download but may not.

4. Watermark image with link to the latest version.

5. Chop up the image into pieces and tile them. May need a macro and parameters to handle this. Most people will get annoyed and give up. You may get sick of slicing up images

6. Some complicated kind of flash eg popup construct could stop screenshots.

7. Forget it. Get over it.

1 vote
MatthewC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 17, 2011

You could put some javascript on every page to disable the right click. It's not fool proof as it's easily by-passed by disabling Javascript but it might make a point.

Go to Confluence admin > Custom HTML & paste the code below into the HEAD section.

If you get an error, just check that the browser hasn't decided to swap the quotes (") and the extended quotes characters (“ ”)

<script language=JavaScript>

var message="Please do not download the images.";

function clickIE6(){

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=clickIE6;

}

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

</script>

You could also stop hot-linking images if you put confluence behind an Apache instance & used re-write rules based on the referer field... but that's another question!

0 votes
Mark Nixon July 20, 2011

Thanks guys for your comments. While you are right and its easy to bypass, its just to stop the 99% of average users quickly saving it and forwarding pictures/images to clients that should not be forwarded.

0 votes
imacutegirl26 July 18, 2011

You could put some javascript on every page to disable the right click. It's not fool proof as it's easily by-passed by disabling Javascript but it might make a point.

Go to Confluence admin > Custom HTML & paste the code below into the HEAD section.

If you get an error, just check that the browser hasn't decided to swap the quotes (") and the extended quotes characters (“ ”)

<script language=JavaScript>

var message="Please do not download the images.";

function clickIE6(){

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=clickIE6;

}

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

</script>

[spam links removed]

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events