How to force links to open in a new window

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く


The information on this page relates to customizations. Consequently, Atlassian Support cannot guarantee to provide any support for the steps described on this page as customizations are not covered under Atlassian Support Offerings. Please be aware that this material is provided for your information only and that you use it at your own risk.

A feature request has been created at CONF-11194 - Getting issue details... STATUS , for interested parties. For more information on how new features are implemented, please see our Implementation of New Features Policy.

A 3rd party plugin is available that reproduces some of this functionality.

目的

By default, links are opened in the same window. To force them to be opened in a new window, follow these steps:

回避策

This customization will only work for Confluence 3.0.1 and above

  1. Logged into Confluence as an administrator, in the top-right corner click >> General Configuration >> Custom HTML
  2. 編集をクリックします
  3. In the At end of the HEAD field, insert this code:
    • For external links only, like [http://www.google.com]:

      <script>
      jQuery(document).ready(function() {
          jQuery(".external-link").attr("target", "_blank");
      });
      </script>
      
    • For all types of links (internal and external):

      <script>
      jQuery(document).ready(function() {
          jQuery(".wiki-content a").attr("target", "_blank");
      });
      </script>
      
    • For including 'Live Search macro' result links on top of all types of links

      <script>
      jQuery(document).ready(function() {
          jQuery(".wiki-content a").attr("target", "_blank");
      });
      
      AJS.toInit(function($) {
      	AJS.$(document).bind('DOMNodeInserted', function(event) {
      	 if ( $(event.target).is(".search-macro-dropdown") ) {
      	       AJS.$("div.wiki-content a").attr("target", "_blank");
      	 }
      	});
      });
      </script>
  4. 保存 を押します

If you'd like to use this functionality on a single page rather than the whole instance, enable the HTML Macro and embed this script in your page.


Keyboard Hotkey

On the other hand, user can also use the keyboard hotkeys below while clicking on a link that should work on most browsers:

機能Windows HotkeyMac Hotkey
Open in New Tab​Ctrl + Click​⌘ + Click
Open in New WindowShift + ClickShift + Click
最終更新日 2023 年 4 月 5 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.