Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS-3 'target-new' and html5 target='_blank' for opening in new tab

Tags:

html

css

I was looking into a solution for opening a page in new tab and then i landed on the CSS-3 property target-new

It states that: "If a user wanted to have new windows open in new tabs instead, she could use the following user style sheet to do so:

*{ target-new: tab ! important }"

I have couple of questions on it:

  • How it functions internally?
  • Why we don't have a property like target="_tab" in html5 specification but had this property as opening a link in new tab doesn't have any direct relation with Presentation?
like image 412
ZeNo Avatar asked Jan 18 '23 00:01

ZeNo


2 Answers

How it functions internally?

No browser has implemented this yet.

Why we don't have a property like target="_tab" in html5 specification but had this property as opening a link in new tab doesn't have any direct relation with Presentation?

target=_blank is still allowed because of backwards compatibility. Introducing new reserved target values, like _tab, wouldn’t work the same across browsers.

IMHO, the decision should be left to the user, and web authors shouldn’t force target=_blank or target-new: tab|window.

like image 67
Mathias Bynens Avatar answered Jan 31 '23 08:01

Mathias Bynens


There is a legitimate reason for using Target=_blank that everybody has completely overlooked, and that is when a website is written as a BOOK with chapters/pages and the Table of Contents must remain intact without using the BACK button to reload the previous page (Table of Contents). This way all a surfer needs to do is close the Target Page when finished reading and they will be back to the Table of Contents. Lucky for us that HTML5 has reinstated the Target="_blank" code, but unfortunately the "Block Popups" must be unchecked for it to work.

like image 38
DocLove Avatar answered Jan 31 '23 07:01

DocLove