Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I allow selections, but disable copying on a page?

Bob Jordan March 6, 2019

Hi, 

I'd like to allow for a section of text to be selected (to allow for inline comments), but disallow it from being copied.

This page illustrates perfectly what I want to do: https://codepen.io/herrberk/pen/yJJgJe

Is there a way to implement that page's code for 'select but not copy' in confluence's CSS? I don't need the alert part, just the disable copy part.

<p class oncopy="return false;" oncut="return false;" oncontextmenu="window.alert('Nice try! Even Ctrl+C or Ctrl+X will not work!');return false;"><i>You can select but can not copy me ;)</i></p>

 

2 answers

1 accepted

1 vote
Answer accepted
Bill Bailey
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.
March 7, 2019

I am with @Marty , I am curious about your use model.

If you are trying to stop unscrupulous copying, it would probably be done by someone who is fully aware of the workaround. For example, with inspecting a page, you can just turn off those CSS rules. Or I can pay someone else to just quickly transcribe the content. If it is online, it can be copied.

If you have the space set to view-only for all users except admin, then you have done as much as you can to protect your content (plus a site-wide copyright statement). But at some point, you have to trust your users. Otherwise, you need to distribute your documentation via secured PDFs only, each one serial numbered, tracked and distributed under NDA. But even that will not protect you from the unscrupulous.

Bob Jordan March 7, 2019

Hi Bill, 

Please see my response to Martyn above. 

I realize that there will always be a way to copy the text if someone is determined enough, but I'd simply like to make it slightly more inconvenient to discourage certain behaviors. 

Like Marty likes this
Bill Bailey
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.
March 8, 2019

Have you tried beatings? ;-)

Yes, weaning people of off Word is really hard. The issue you have is trying to disable the copy function but still allow the inline commenting (which requires the ability to highlight). So that means you cant use the CSS hack you showed to just disable the ability to highlght/select. You need to be able to implement the events:

oncopy="return false;" oncut="return false;

Which would need to be implemented on the main content container of the page:

<div id="main-content" class="wiki-content"> 
</div>

And that means you need to modify page layout. Which now is easier to do than before. Go to the admin console, Layouts under Look and Feel.

customizing-site-and-space-layouts

 

Use with caution, actual mileage may vary.

Like Marty likes this
Bob Jordan March 11, 2019

Cheers Bill, thanks for that.

Unfortunately I don't have system admin privileges (I don't have the 'general config' -> 'layouts' option. 

Sounds like layout editing would be the only way to accomplish this? Is there anything you can think of that may be available in the "space tools" that would solve for this as well? 

Otherwise I'll just need to find and bug the system admin :|

Bill Bailey
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.
March 11, 2019

Yeah, this is an admin only feature due to the far-reaching implications of changing these templates.

Bob Jordan March 12, 2019

Ok, I'll have to bug them then. Thanks for the help with this one :)

Sneha Gole
Contributor
July 27, 2020

hello, @Bill Bailey  i have made changes as you were list above in page layout. but i want to restrict copy for specific "space " only ..how to do that?

3 votes
Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 6, 2019

Hi Bob,

I am not from the Confluence team, but I will try to help.

In general trying to prevent people from copying content from a web page will not be 100% airtight.  People can take screenshots.  Or take photos with their phones.  Or open up the developer tools, inspect an element, and copy the content that way.

The code you're trying to add to the page might fool some users but not all.

I wondered if you could share a little more about why you're trying to prevent users from copying some content and perhaps I can suggest a different way to use Confluence to achieve your goals?

Bob Jordan March 7, 2019

Hey Martyn,

Thanks for the response. 

I understand that nothing is 100% secure and I'm not worried about this. I only want to put in road blocks and make the process inconvenient. 

My use case is that we use confluence to review team documents. Some members outside of my team will copy and paste the contents of the page into a word document and send their review comments that way rather than commenting on the page directly (even though of course we've asked them not to). I'd like to discourage that behavior, so making the text selectable to allow for in-line commenting but not copyable should be sufficient.

Like Marty likes this
Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 7, 2019

Ahh that makes sense.  That does sound frustrating!

Sorry to hear that.  Let's see if the community can help you with a small CSS trick then.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events