fix #129 - only open external links in a new tab

This commit is contained in:
Marco Biedermann 2016-06-28 16:18:50 +02:00
parent 1e4089a9e9
commit 209a58ee1a
2 changed files with 11 additions and 3 deletions

View File

@ -8,9 +8,6 @@
<!-- <meta name="theme-color" content="#2980b9"> -->
<!-- <meta name="google-site-verification" content=""> -->
<!-- Open all links in a new tab/window -->
<base target="_blank">
<title>{% if page.title %}{{ page.title | xml_escape }}{% else %}{{ site.title | xml_escape }}{% endif %}</title>
<link rel="stylesheet" href="main.css">

View File

@ -32,6 +32,17 @@
sel.addRange(range);
};
// open external links in new tab
var links = document.links;
var linksLength = links.length;
var i = 0;
for (i = 0; i < linksLength; i++) {
if (links[i].hostname != window.location.hostname) {
links[i].target = '_blank';
}
}
</script>
{% include analytics.html %}
</html>