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?
Community moderators have prevented the ability to post new answers.
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.
Thanks, David.
I tired it, but it didn't work. The PDFs are still opening in the same window. Still looking.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have another go. Btw: which browser are you using? Does it currently open PDFs within the browser window?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Theo,
Unfortunately it's a restricted function in onDemand
https://confluence.atlassian.com/display/AOD/Restricted+Functions+in+Atlassian+OnDemand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.