Help us understand the problem. What is going on with this article?

Qiitaの外部へのリンクを新規タブ(ウィンドウ)にする

More than 5 years have passed since last update.

qiitaのページ中にある外部リンクにtarget="_blank"とつけるだけです。よくあるやつのコピペです。

TampermonkeyとGreasemonkeyで確認しています。

Classに"external"とつけているので、適当なデコレーションをするとわかりやすいです。

// ==UserScript==
// @name         Add blank to qiita
// @namespace    http://your.homepage/
// @version      0.1
// @description  enter something useful
// @author       You
// @match        http://qiita.com/*
// @grant        none
/* load jQuery */  
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js  
// ==/UserScript==

jQuery(document).ready(function(){
    jQuery('a[href^=http]')
    .not('[href*="'+location.hostname+'"]')
    .attr({target:"_blank"})
    .addClass("external")
    ;})  

僕はIcoMoonというフォントでデコレーションしています。

a.external:before{
  font-family:"icomoon";
  content:"\ea7e";
  padding-right:2px;
}
yukichi
Qiitaに書くことじゃないけど、最近Mediumで日本語訳やっています。ツッコミ歓迎 https://medium.com/@yukichi
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした