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"
>
.cp-control-panel-download {
display:none !important;
}
.cp-waiting-message-download {
display:none !important;
}
a.download-all-link {
display: none !important;
}
a#download-all-link {
display: none !important;
}
</
style
>
Hide attachment button
Space Tools--Look and feel--Layout--Content Layouts---Main Layout
#if ($userAccessor.hasMembership('confluence-administrators', $helper.action.remoteUser.name))
#else
<
script
type
=
"text/javascript"
>
AJS.toInit(function(){
AJS.$('#view-attachments-link').hide();
AJS.$('#view-in-hierarchy-link').hide();
AJS.$('#content-metadata-attachments').hide();
});
</script
>
#end
#if ($userAccessor.hasMembership('confluence-administrators', $helper.action.remoteUser.name))
#else
<
script
type
=
"text/javascript"
>
AJS.toInit(function(){
AJS.$('#space-tools-menu-trigger').hide();
});
</script
>
#end
disable right mouse click
Space Tools--Look and feel--Layout--Content Layouts---Page Layout
<
script
type
=
"application/javascript"
>
content_dom = document.getElementsByClassName("confluence-embedded-file");
for (var i = 0; i <
content_dom.length
; i++) {
content_dom[i].oncontextmenu
=
function
() {
return false;
}
}
a_dom=
document
.querySelectorAll('a[
data-linked-resource-type
=
"attachment"
]')
for (var
i
=
0
; i < a_dom.length; i++) {
a_dom[i].oncontextmenu
=
function
() {
return false;
}
}
</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-disable-attachment-downloads-215484007.html
https://community.atlassian.com/t5/Confluence-questions/Hide-items-in-option-menu/qaq-p/920803
Ollie Guan
Project Manager
ctrip
Shanghai
703 accepted answers
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
5 comments