This is a line for a hyperlink in HTML:
<a href="http://www.starfall.com/">Starfall</a>
Thus, if I click on "Starfall" my browser - I am using FireFox - will take me to that new page and the contents of my window will change. I wonder, how can I do this in HTML so that the new page is opened in a new window instead of changing the previous one? Is there such a way in HTML?
And if yes, is there a way to open the requested page in another tab (not another window) of my browser?
You can open a new window (HTML4) or a new browsing context (HTML5). Browsing context in modern browsers is mostly "new tab" instead of "new window". You have no influence on that, and you can't "force" modern browsers to open a new window. In order to do this, use the anchor element's attribute target.
Creating links to open in a separate tab is accomplished by adding additional text to the end of your page URL. This instructs the web browser to open the link as a new tab.
A target attribute with the value of “_blank” opens the linked document in a new window or tab. A target attribute with the value of “_self” opens the linked document in the same frame as it was clicked (this is the default and usually does not need to be specified).
You can hold the Shift key and left-click a link to force opening in a new window.
<a href="http://www.starfall.com/" target="_blank">Starfall</a>
Whether it opens in a tab or another window though is up to how a user has configured her browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With