Within a page and you have a "link" to another page I would like this page to open a new window/tab each time. I understand you can right click on the link and "open in ew tab" option but most people just click on the link and it uses the same page hence to view the instructions/content you have to back space each time. I would like an link to open a new page automatically. I belioeve this may not be good practise for certain reason so can you advise if it is good practise and how it can be done thanks..
you can try like this
<script> jQuery(document).ready(function() { if(AJS.$('#confluence-space-key').attr('content') == 'TO'){ AJS.$(".wiki-content a").attr("target", "_blank"); } }); </script>
if my answers helped then don't forgot to accept as answer:)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thank you this was the resolution and if statement for a space key..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One slight edit that would future proof this a little would be to use the AJS.Meta.get method to get the space key.
<script> jQuery(document).ready(function() { if(AJS.Meta.get("space-key") == 'TO'){ AJS.$(".wiki-content a").attr("target", "_blank"); } }); </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
check the following doc
https://confluence.atlassian.com/display/CONFKB/How+to+Force+Links+to+Open+in+a+New+Window
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for this..
Is there a way I can do it for a certain space key only rather than whole look and feel..can I amend the html code for just a certain space please..thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
tried to edit the target space details and chose space admin. I do not see anyway of choosing "custom html" within this space only under the Look and Feel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
it will be on Administration >> Custom HTML not on the target space details.
if you don't have administration permission then ask your confluence administartor to add the script
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
but will this change the issue for all spaces..I only want to do it for a space for my area and not the complete look and feel for all spaces ?thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You'll need to put an "if" statement into the javascript to detect the current space and only activate if it matches the spaces you need it for.
For what it's worth though, opening in a new window/tab every time is a royal pain in the neck for most users as you quickly litter their workspaces with pages they don't care about any more. It should be used sparingly, not on every link.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
but where will the if statement lie within here if the Space key is called "TO":
<script> jQuery(document).ready(function() { jQuery( ".wiki-content a" ).attr( "target" , "_blank" ); }); </script> |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can someone tell me how to put an "if" statement to the script please if spacekey is called "TO"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you provide UI source code of space key then i can able to help you, because i don't confluence on my machine!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
http://wiki.wonga.com/display/TO/Welcome+to+Technology+Operations
is this what you are looking for?thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
use firebug on firefox or JavaScript console on chrome and get the HTML code for that link
or
press Ctrl + u it will give source code of entaire page, from that you can copy the html code for that link
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<html> | |
<head> | |
<title>Welcome to Technology Operations - Technology Operations - Wonga Wiki</title> | |
<meta http-equiv="X-UA-Compatible" content="IE=EDGE,chrome=IE7"> | |
<meta charset="UTF-8"> | |
<!-- Deprecated since 3.4. To be removed in a future version of Confluence; use AJS.Confluence.getContextPath() --> | |
<meta id="confluence-context-path" name="confluence-context-path" content=""> | |
<meta id="confluence-base-url" name="confluence-base-url" content="http://wiki.wonga.com"> | |
<meta id="atlassian-token" name="atlassian-token" content="69a6a0c404663e80828d3067ad47341ff39fc514"> | |
<meta id="confluence-space-key" name="confluence-space-key" content="TO"> | |
<script type="text/javascript"> | |
// Deprecated global variables. To be removed in a future version of Confluence. | |
var contextPath = ''; | |
</script> | |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
from cntrl u
<link rel="canonical" href="http://wiki.wonga.com/display/TO/Welcome+to+Technology+Operations"> | |
<link rel="shortlink" href="http://wiki.wonga.com/x/xY3pAw"> |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<link rel="canonical" href="http://wiki.wonga.com/display/TO/Welcome+to+Technology+Operations"> | |
<link rel="shortlink"href="http://wiki.wonga.com/x/xY3pAw">
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I also tried to add this statement
#if (AJS.params.spaceKey == 'TO')
to what you suggested as space key is TO na ddidnt work..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.