Window.open() | Window open top
IfJavaScriptsupportisdisabledornon-existent,thentheuseragentwillcreateasecondarywindowaccordinglyorwillrenderthereferencedresourceaccordingtoitshandlingofthetargetattribute.Thegoalandtheideaaretoprovide(andnotimpose)totheuserawaytoopenthereferencedresource.HTML
If JavaScript support is disabled or non-existent, then the user agent will create a secondary window accordingly or will render the referenced resource according to its handling of the target attribute. The goal and the idea are to provide (and not impose) to the user a way to open the referenced resource.
HTML <a href="https://www.wikipedia.org/" target="OpenWikipediaWindow"> Wikipedia, a free encyclopedia (opens in another, possibly already existing, tab) </a> JavaScript let windowObjectReference = null; function openRequestedTab(url, windowName) { if (windowObjectReference === null || windowObjectReference.closed) { windowObjectReference = window.open(url, windowName); } else { windowObjectReference.focus(); } } const link = document.querySelector("a[target=OpenWikipediaWindow]"); link.addEventListener( "click", (event) => { openRequestedTab(link.href); event.preventDefault(); }, false );The above code solves a few usa...