How can I add a watermark to a page?

How can I add a "Draft" or "Obsolete" watermark to a page in Confluence?

5 answers

1 accepted

I developed a user macro to do this, using jQuery to position an attached image within the body of the page. You'll see it explained in this presentation I gave at the Atlassian Summit in 2011. Confluence has evolved since then, so it may need tweaking to work with the latest version. http://www.atlassian.com/company/about/events/summit/2010/presentations/collaboration-and-projects/macros-reports-confluence.jsp

Perfect, that's exactly what I was looking for, thanks. Is that macro available for download?

I've taken the original macro and updated it for Confluence 4.x. You'll find it in the shared user macro library here.

Hi Charles - is this macro compatible with Confluence version 5.2? I tried using the macro but the image won't show on the page that contains the watermark image. I tried both providing the full URL and just the actual name of the image.

Hi Doods,

I just tried the macro with Confluence 5.0 and it works just like it does under 4.x, both for the Documentation theme and the default theme.

In my simple test I uploaded an image file as an attachment to the page where I want the watermark to appear, then just used the image file name and extension in the parameter for the user macro.

If you're doing the same, then it would help to inspect what's going on with the aid of some browser development tools, e.g. Firebug.

The general approach is for the watermark image to be added as a background image using javascript to the main div element which is the container for the page content. For the documentation theme this div element has the class "wiki-content". For the default theme this div is/was identifiable with an ID of "content". It could be that in 5.2 this has changed. I don't have an instance of 5.2 handy though...

Which theme are you using when you try out the macro?

Charles

We are on an older Confluence version. Is this macro compatible with 3.5 and on the documentation theme?

Thanks.

-p

It should do (especially the code offered in the slideshare presentation) as I created the user macro against that version and theme I think. Give it a try is the best advice I think.

Charles, I know this macro was written some years ago, but we are setting up an enterprise intranet using confluence and we have installed your watermark macros with Confluence 6.8.1 to provide the ability for users to create pages with a watermark or background image.

We have just had the solution pen tested and the report advises that there is a potential vulnerbility with your macro:

This macro passed the imgsrc parameter unsanitised to the code, so the jQuery function could be broken out of and closed, and malicious JavaScript executed afterwards. In order to do this, the value had to start with http or else it would be manipulated by the pre-processor.
The consultants were able to use this macro with the following payload and get JavaScript execution.

http://')} </script><script>alert("ptp xss")</script>

 

Is there anyway you could possibly update your macro to remove this vulnerability?

@CharlesH1 @charlesh

Thanks for this macro - works like a charm.

Is it possible to incorporate the ability for the macro to appear when the content is exported (Word/PDF)? Currently it does not.

Regards

Rethabile M

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
Published Thursday in Confluence

Three common content challenges + how to manage them

An efficient enterprise content management system, or ECM, is a must-have for companies that create work online (cough   cough, all companies). If content calendars, marketing plans, and bu...

86 views 0 6
Read article

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