You're visiting the Confluence Knowledge Base. Visit the Confluence Knowledge Base Home for an overview.

Skip to end of metadata
Go to start of metadata

Opening attachments will result in a new tab, leaving the page it is attached to open in other tab.

Solution

Modifying the template file in confluence-attachments-plugin-x.x.jar (in this case, I try on confluence-attachments-plugin-2.10.jar). Please edit attachmentsmacro.vm file. This file is located in confluence-attachments-plugin-2.10.jar file. Extract this file by using the Editing files within .jar archives guide guide.

If you are able to extract it successfully, you can locate to attachmentsmacro.vm file and find the following lines:

and change the above code to be:

After making changes, please repack the file by following the steps here.

For newer Confluence versions:

  • For List Attachments page under Space (via Space >> Browse >> Attachments), the file to be edited can be found at:
    <confluence-install>/confluence/pages/listattachmentsforspace.vm. Find for the following lines of code:

    and change it to

  • For Attachments page under Page (via Page >> Tools >> Attachments), the file to be edited can be found at:
    <confluence-install>/confluence/pages/includes/attachments-table.vm. Find for the following lines of code:

    and change it to

Help us improve!

Is this article helpful?
Is it well written?
Is the content complete?

3 Comments

  1. hi where  can find confluence-attachments-plugin-2.10.jar

    am using confluence 3.5.6 version

    installed directory  D:\confluence\confluence-3.5.6-std

    home directory D:\confluence\data

  2. but it is not working for following code [^Linking to attachments.pdf]
    it is only working on 'view attachments' pages not attachment link with in page [above code]

     

     

     

  3. Really, don't do that. It's a very bad idea for maintainability. This hack will get blasted every time you upgrade.

    Instead, use a little bit of Javascript to open attachments in a new window...

    Browse to Confluence Admin | Look & Feel | Custom HTML & paste into At the end of the HEAD: