Comments on: target=blank https://css-tricks.com/targetblank/ Tips, Tricks, and Techniques on using Cascading Style Sheets. Wed, 16 Jun 2021 18:55:57 +0000 hourly 1 https://wordpress.org/?v=6.1.1 By: Mark Root-Wiley https://css-tricks.com/targetblank/#comment-1774116 Wed, 16 Jun 2021 18:55:57 +0000 https://css-tricks.com/?p=341916#comment-1774116 The best 2021-real-world example of this I can think of is straight out of WordPress!

The preview link in the post editor uses target="wp-preview-1234" where 1234 is the post ID. That means there’s only ever one tab with the preview of a specific post. If you preview multiple times, it always updates refreshes the existing named tab rather than spawning a second, third, or fourth tab.

(Tangent: I’ve seen people accidentally spawn multiple Edit screens of the same post by opening a preview and then clicking the “Edit Page” button in the admin bar. I wonder if it’s possible for a page to name its own tab when opened—not as a new tab—so that the edit links could also prevent people from editing the same page in multiple tabs. I’m guessing no, but maybe there’s some trickery out there that makes it possible.)

]]>
By: Sristy Suman https://css-tricks.com/targetblank/#comment-1773991 Mon, 14 Jun 2021 17:33:13 +0000 https://css-tricks.com/?p=341916#comment-1773991 In reply to VVutov.

I didn’t knew this, as I am newbie to web development. Thank you for sharing this information. Love to know more .

]]>
By: Vladislav Vutov https://css-tricks.com/targetblank/#comment-1773905 Sun, 13 Jun 2021 12:23:35 +0000 https://css-tricks.com/?p=341916#comment-1773905 In reply to v Vutov.

Thanks for the answer! I understood the difference between “blank” and “_blank”. If i have opened two webpages website.com which uses target = “newTabEveryTime”, for all the hrefs on website.com, it opens two new tabs for the two instances of website.com. Does that have anything to do with tabId? I would really like to find a way a href from any page of the website.com (if you work with lets say 15 opened tabs of the website.com content) to open always in only one new tab.

]]>
By: Peter https://css-tricks.com/targetblank/#comment-1773849 Fri, 11 Jun 2021 22:13:16 +0000 https://css-tricks.com/?p=341916#comment-1773849 I thought the target attribute was deprecated but I see they reversed that, I did wonder why a site like this would be writing about a deprecated attribute … hard to keep up, thanks for the enlightenment.

I still think it’s an attribute of the past, javascript was simple to implement.

Maybe a framework required it, does anyone know?

]]>
By: Jason https://css-tricks.com/targetblank/#comment-1773806 Fri, 11 Jun 2021 04:39:26 +0000 https://css-tricks.com/?p=341916#comment-1773806 In reply to v Vutov.

The example above is for target=blank (without underscore), not target=_blank (with underscore). Also,

In the case of the no-underscore target=”blank”, the blank part is just a name. It could be anything. It could be target=”foo” or, perhaps to foreshadow the purpose here: target=”open-new-links-in-this-space”.
And,
The difference:
target=”_blank” is a special keyword that will open links in a new tab every time.
target=”blank” will open the first-clicked link in a new tab, but any future links that share target=”blank” will open in that same newly-opened tab.

]]>
By: Jean-Michel FRANCOIS https://css-tricks.com/targetblank/#comment-1773765 Thu, 10 Jun 2021 15:26:50 +0000 https://css-tricks.com/?p=341916#comment-1773765 This has mainly be used to create page using different iframes. I did this to create a simple static website with menu and without php back in 90s.
It is well explained https://www.w3schools.com/html/html_iframe.asp

Do not forget security concerns when you use target attribute like explaineed in
https://medium.com/sedeo/how-to-fix-target-blank-a-security-and-performance-issue-in-web-pages-2118eba1ce2f

]]>
By: v Vutov https://css-tricks.com/targetblank/#comment-1773753 Thu, 10 Jun 2021 11:23:33 +0000 https://css-tricks.com/?p=341916#comment-1773753 Hi! If you open the index.html in two tabs which are practically the same the links with target=”_blank” do not open in the same tab, but actually it would open them in two different tabs for the two initial tabs.
I hope i explained it ok. :)
Is there any way to make links from different pages (if i have many instances of the same page ) open in the exact same tab, every time?

]]>
By: Nikita Spivak https://css-tricks.com/targetblank/#comment-1773749 Thu, 10 Jun 2021 10:46:28 +0000 https://css-tricks.com/?p=341916#comment-1773749 In reply to Ricardo Zea.

I think the thing is every day born mullions of babies and every day thousands people learning something new. That’s why posts with simple and easy info are actual.

]]>
By: lnfel https://css-tricks.com/targetblank/#comment-1773733 Thu, 10 Jun 2021 04:38:47 +0000 https://css-tricks.com/?p=341916#comment-1773733 I have a website that I created from the early days, (around 2009) where I kept all my diary related stuffs. Still working to this day and the site uses framesets. One of the coolest things back then.

]]>
By: VVutov https://css-tricks.com/targetblank/#comment-1773732 Thu, 10 Jun 2021 04:31:05 +0000 https://css-tricks.com/?p=341916#comment-1773732 If you reload the initial page or open two instances of it, using “_blank” will open two different “new tabs”. Is there a way to keep the new content in only and exactly one opened new tab?

]]>
By: Chris Coyier https://css-tricks.com/targetblank/#comment-1773725 Thu, 10 Jun 2021 01:13:24 +0000 https://css-tricks.com/?p=341916#comment-1773725 In reply to Ricardo Zea.

If I didn’t blog things because I was worried that some people might already know it, there would be zero blog posts on this site.

]]>
By: Ricardo Zea https://css-tricks.com/targetblank/#comment-1773724 Thu, 10 Jun 2021 00:07:18 +0000 https://css-tricks.com/?p=341916#comment-1773724 ‪I’ve known this for more than a decade, I can’t believe this is the talk these days ‬

]]>
By: Jason https://css-tricks.com/targetblank/#comment-1773718 Wed, 09 Jun 2021 22:24:38 +0000 https://css-tricks.com/?p=341916#comment-1773718 Also, be aware of the fact, opening a new tab/window using target=”blank” has potential privacy and security implications (_though I do believe newer browsers now set rel=”noopener” by default).

Alex Yumashev, over at Jitbit, has an excellent explanation of the issue(s):
Target=”_blank” – the most underestimated vulnerability ever

]]>
By: Greg Hemphill https://css-tricks.com/targetblank/#comment-1773717 Wed, 09 Jun 2021 19:55:43 +0000 https://css-tricks.com/?p=341916#comment-1773717 I think you’re playing with fire if you use “blank”, it’s too confusingly close to the special keyword “_blank”. You’re going to end up with people mistaking them.

Remember targets are a holdover from before we had Ajax and people would use Frames to to update portions of the page with content from the server. Targets were meant to have semantic names like “shopping-cart” or locations like “right-sidebar”. Latterly naming a frame or window “blank” doesn’t make much sense.

]]>
By: Vlad https://css-tricks.com/targetblank/#comment-1773716 Wed, 09 Jun 2021 19:46:09 +0000 https://css-tricks.com/?p=341916#comment-1773716 Anyone who worked extensively with frames/framesets in the 1990s or early 2000s knows the difference between target=”_blank” and target=”blank/something”. The mercy of the early birth.

]]>