Flutizität erhöhen (link prefetch=
parent
d522878755
commit
704c9c0cbf
|
@ -78,6 +78,6 @@
|
||||||
<link rel="stylesheet" href="{{ "css/style.css" | relURL }}" />
|
<link rel="stylesheet" href="{{ "css/style.css" | relURL }}" />
|
||||||
<link rel="shortcut icon" href="{{ "images/favicon.ico" | relURL }}" type="image/x-icon" />
|
<link rel="shortcut icon" href="{{ "images/favicon.ico" | relURL }}" type="image/x-icon" />
|
||||||
<script src="/js/jquery-3.7.1.min.js"></script>
|
<script src="/js/jquery-3.7.1.min.js"></script>
|
||||||
<script src="/js/layout.js"></script>
|
<script src="/js/href_handling.js.js"></script>
|
||||||
<script src="/js/door-status.js"></script>
|
<script src="/js/door-status.js"></script>
|
||||||
<script src="/js/calendar.js"></script>
|
<script src="/js/calendar.js"></script>
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
document.querySelectorAll('a').forEach(function(element) {
|
||||||
|
const myhost = window.location.hostname;
|
||||||
|
const linkhost=new URL(element.href).hostname;
|
||||||
|
if(myhost === linkhost) {
|
||||||
|
let prefetchUrl=new URL(element.href).toString()
|
||||||
|
// lest make a prefetch tag for this url
|
||||||
|
let link = document.createElement('link');
|
||||||
|
link.setAttribute('rel', 'prefetch');
|
||||||
|
link.setAttribute('href', prefetchUrl);
|
||||||
|
link.setAttribute('as', 'document');
|
||||||
|
document.head.appendChild(link);
|
||||||
|
}else {
|
||||||
|
element.setAttribute("target", "_blank");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
|
@ -1,9 +0,0 @@
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
|
||||||
document.querySelectorAll('a[href^="http"]').forEach(function(element) {
|
|
||||||
const myhost = window.location.hostname;
|
|
||||||
const linkhost=new URL(element.href).hostname;
|
|
||||||
if(myhost === linkhost) return;
|
|
||||||
element.setAttribute("target","_blank");
|
|
||||||
})
|
|
||||||
});
|
|
Loading…
Reference in New Issue