Skip to content

Commit

Permalink
Updated link bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexurquhart committed Jan 13, 2017
1 parent d54e167 commit a4c53c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions static/js/App.js
Expand Up @@ -13,12 +13,12 @@ if (!window.location.origin) {
$(document).ready(function() {

// Change all href links that go out of the origin to open in a new window
// Relative links that start with / or . (ie /post/my-post or ../post/my-post)
// Relative links that start with /, #, or . (ie /post/my-post or ../post/my-post or #test)
// should be untouched
$("a").each(function(i, el) {
var href = $(el).attr("href");

if (typeof href === "string" && href.indexOf(window.location.origin) === -1 && href[0] !== "/" && href[0] !== ".") {
if (typeof href === "string" && href.indexOf(window.location.origin) === -1 && "/.#".indexOf(href[0]) === -1) {
$(el).attr("target", "_blank");
}
});
Expand Down

0 comments on commit a4c53c1

Please sign in to comment.