Recently, some teams using Confluence have put forward more advanced requirements for information confidentiality.
These space administrators want to prohibit users from downloading, exporting, and printing attachments in designated spaces.
Last week, I checked a lot of related setting posts in the community. According to the community’s suggestions, I adjusted the space configuration for your reference.
Hide the download button on the preview page
Space Tools--Look and feel--Layout--Content Layouts---Page Layout
style type="text/css"><br> .cp-control-panel-download {<br> display:none !important;<br> }<br> .cp-waiting-message-download {<br> display:none !important;<br> }
a.download-all-link {<br> display: none !important;<br> }
a#download-all-link {<br> display: none !important;<br> }<br> </style><
Hide attachment button
Space Tools--Look and feel--Layout--Content Layouts---Main Layout
#else<br> <script type="text/javascript"><br> AJS.toInit(function(){<br> AJS.$('#view-attachments-link').hide();<br> AJS.$('#view-in-hierarchy-link').hide();<br> AJS.$('#content-metadata-attachments').hide();<br> });<br></script><br>#end
#if ($userAccessor.hasMembership('confluence-administrators', $helper.action.remoteUser.name))<br>#else<br> <script type="text/javascript"><br> AJS.toInit(function(){<br>AJS.$('#space-tools-menu-trigger').hide();<br> });<br></script><br>#end#if ($userAccessor.hasMembership('confluence-administrators', $helper.action.remoteUser.name))<br>
disable right mouse click
Space Tools--Look and feel--Layout--Content Layouts---Page Layout
script type="application/javascript"><br> content_dom = document.getElementsByClassName("confluence-embedded-file");<br> for (var i = 0; i < content_dom.length; i++) {<br>content_dom[i].oncontextmenu = function () {<br>return false;<br> }<br>}<br>a_dom = document.querySelectorAll('a[data-linked-resource-type="attachment"]')<br>for (var i = 0; i < a_dom.length; i++) {<br>a_dom[i].oncontextmenu = function () {<br>return false;<br> }<br>}<br></script><
print out a blank page
Space Tools--Look and feel--Layout--Content Layouts---Page Layout
<style type="text/css" media="print">
body { visibility: hidden; display: none }
</style>
Tips
https://confluence.atlassian.com/confkb/how-to-hide-the-space-tools-menu-for-anonymous-users-in-confluence-816877024.html
https://confluence.atlassian.com/confkb/how-to-hide-elements-in-confluence-using-css-or-javascript-313458894.html
https://confluence.atlassian.com/confkb/how-to-disable-attachment-downloads-215484007.html
https://community.atlassian.com/t5/Confluence-questions/Hide-items-in-option-menu/qaq-p/920803
https://community.atlassian.com/t5/Confluence-questions/Disable-CTRL-P-function-Prevent-Printing/qaq-p/1050179
https://stackoverflow.com/questions/6647392/how-to-stop-user-from-printing-webpages-using-javascript-or-jquery