remove target="_blank" for PWA users
parent
f272989735
commit
3f0966bf03
|
@ -266,6 +266,9 @@ function bs_trigger(e) {
|
|||
i.addEventListener('keydown', speed_carot_navigate, false);
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof link_trigger === "function")
|
||||
link_trigger(e);
|
||||
}
|
||||
|
||||
var bsTriggerOnReady = function() {
|
||||
|
|
|
@ -11,6 +11,19 @@
|
|||
{% macro javascript() %}
|
||||
<script defer src="{{'js/vendor/bootstrap.js' | asset}}"></script>
|
||||
<script defer src="{{'js/core.js' | asset}}"></script>
|
||||
|
||||
<script>
|
||||
if (window.matchMedia('(display-mode: standalone)')['matches']) { // if PWA
|
||||
function link_trigger(e) {
|
||||
const links = e.querySelectorAll('a[target="_blank"]'); // get links with target="_blank"
|
||||
for (const link of links) { // loop on them
|
||||
link.removeAttribute("target");
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', link_trigger(document));
|
||||
}
|
||||
</script>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro page_meta(title=none) %}
|
||||
|
|
Loading…
Reference in New Issue