i did not read all nice and surely beautiful answers here below. Nor if it is a question that should get an answer to resolve an issue or just a comment to a forum's behavior when external links clicked.
Anyway let me add mine stupid obvious, may also out of the contest because it was not the question.
Open external (i think the question is about external links that points to a resource out of the phpBB)
links in a new tab.... an extension? yes can be injected via an extension, but maybe it is easier also like this
into overall_footer.html, since passed url that are external, do not contains domain name (but there are more ways to detect and get the right result):
Code: Select all
<script>
var boardU = "{BOARD_URL}";
$(document).on("click", "a", function(e) {
var href = $(this).attr("href"); // this line required and was missed
// external link?
if ((this.href.indexOf(boardU) > -1) != true){
if(/^(f|ht)tps?:\/\//i.test(href))
{
e.preventDefault();
window.open(href,'_blank');
return;
}
}
});
</script>
and do not forget to stay cool! ...which may is another not useful consideration
[JS code EDITED]