Edit in JSFiddle

$(function () {
    $("a[href^=http]").each(function () {
            $(this).attr({target: "_blank"});
    });
});
<a href="https://jsfiddle.net/">Link</a>

<a href="https://www.facebook.com">Facebook</a>

<a href="https://twitter.com/millkeyweb">Twitter</a>

<a href="https://google.com">Google</a>

<a href="http://www.yahoo.co.jp">Yahoo!</a>