Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Open up a new tab/window

minesh patel October 26, 2011

Hello,

I would like to have a new tab/window open up when opening a PDF in confluence.

Is this possible? What is the fix?

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 26, 2011

Add some JavaScript in: Confluence Admin | Custom HTML:

<script>
  AJS.toInit(function(){
    AJS.$('a[href$=".pdf"]').attr('target', '_blank'); // open all URLs ending in .pdf in a new window
  });
</script>

Update: I've removed the spaces in the script tags and tested it -- works fine for all URLs ending in .pdf in browsers that open PDFs in a browser window e.g. Chrome, Safari etc.

minesh patel October 26, 2011

Thanks, David.

I tired it, but it didn't work. The PDFs are still opening in the same window. Still looking.

David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 26, 2011

Have another go. Btw: which browser are you using? Does it currently open PDFs within the browser window?

minesh patel October 26, 2011

David,

Tired it again, still go the same results as before. Using IE 8 and Firefox 3.6. Yes, it opens in the same browser window.

Theo T May 27, 2013

Dear David,

Is it possible to add this piece of JavaScript in the On-Demand version of Confluence or can it only be setup in self-hosted Confluence installations?

Best regards,
Theo

1 vote
MatthewC
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.
May 27, 2013

Hi Theo,

Unfortunately it's a restricted function in onDemand

https://confluence.atlassian.com/display/AOD/Restricted+Functions+in+Atlassian+OnDemand

Theo T May 27, 2013

Thanks for your clearing that up, Matthews.

0 votes
Theo T May 27, 2013
When you are using Google Chrome as your main browser, you can install the following extension in your browser:
This extension prevents webservers from forcing PDFs to download rather than open in your browser. I tested this with our On-Demand Confluence site and it works like a charm.
TAGS
AUG Leaders

Atlassian Community Events