How do i prevent downloading of pictures on a page

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

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.

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!

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]

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.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

774 views 23 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you