リンクを別のタブで開くテスト

f:id:tmfgxx:20180516153010p:plain

f:id:tmfgxx:20180516153026p:plain

 

 

この場所に

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
(function($){
$(function() {
/*
            question:1423594976
            記事内のリンクに target='_blank' を設定する
        */
var forEach = Array.prototype.forEach;
var changeTarget = function(ctx) {
forEach.call(document.body.querySelectorAll('article.entry div.entry-content a'), function (item) {
if (item.target == '') {
item.target = '_blank';
}
});
};
changeTarget(document.body);
});
})(jQuery);
</script>

参考サイト

はてなブログで、リンクを設定する際に、「新しいタブで開く」よ… - 人力検索はてな

 

参考にしたサイトのやり方だと、スマホで適用されないようなので

スクリプト書く場所変更しました。