Describe the feature you'd like
I like the default for internal links that they use the same browser tab. However I think if you're clicking on an external link (and it is not yet #1620 visually distinguished) my expectation for it are that it opens a new browser tab instead of using the "dedicated BookStack" tab.
Describe the benefits this feature would bring to BookStack users
Not sure how common my perspective is, but I think the proposed feature doesn't violate expectations.
Hello @bandresen,
You could accomplish this by placing the following script in your "Custom HTML Head" field in BookStack settings:
<script>
document.addEventListener("DOMContentLoaded", function(){
var links = document.links;
for (var i = 0, linksLength = links.length; i < linksLength; i++) {
if (links[i].hostname != window.location.hostname) {
links[i].target = '_blank';
}
}
});
</script>
Thanks for the suggestion @bandresen,
Currently users have control of this via the editor so it gets a little more complicated when we have to officially take that into account. In addition, I remain very apprehensive to alter the existing behaviour of the content that users have put into their BookStack instance.
I think the above workaround covers this kind of use-case perfectly well, and could be easily altered for other requirements such as adding noreferrer or noopener attributes. Thanks for providing @james-geiger.
Therefore closing this.
Most helpful comment
Hello @bandresen,
You could accomplish this by placing the following script in your "Custom HTML Head" field in BookStack settings: