Is it possible to force links to open in a new window/tab using javascript by changing the target attribute when the page is loaded, but only for external links?
EDIT:
Is there a better way to do this.
Does anyone have any example I could use when writing my code?
Yes, it’s possible. User browser preferences will still win out but if you’d like to change the default target attribute of links on load of a page, you could call a function like this
onload:Hope this helps.