Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens when you click on a target="_blank" link on a mobile device?

I have a very good reason to use target="_blank" on links on my website (please don't tell me about standards). What happens when you click the link on a mobile device? I don't have a phone to test it.

like image 933
Leo Jiang Avatar asked Oct 18 '11 20:10

Leo Jiang


People also ask

What happens if you add target _blank to a link?

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.

Does target blank work on mobile?

It just opens in the same browser window on these problematic devices (works fine on mine). I have confirmed that either way (target="_blank" or JS) does work on other multiple devices, including my Android phone.

What does a target _blank do?

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).

Is Target _blank safe?

There's A Security Reason For Not Using _Blank Google's Web. dev page on the risks of using the _blank link attribute is summarized as such: “The other page may run on the same process as your page. If the other page is running a lot of JavaScript, your page's performance may suffer.


2 Answers

On the iPhone, it will force Safari to open the link in a new tab.

like image 135
Michael Irigoyen Avatar answered Sep 29 '22 10:09

Michael Irigoyen


On iOS4 devices, it opens in a new "page" within safari and the new page takes focus. Haven't upgraded to ios5 yet, but I imagine it's the same but with tabs. I don't know about other platforms, sorry

like image 41
hair raisin Avatar answered Sep 29 '22 09:09

hair raisin