To target=_blank or not to target=_blank, that is the question!

前端 未结 8 1890
野的像风
野的像风 2021-02-03 21:58

Should links to external sites set target=_blank? E.g. I am on www.acme.net and have a link to www.otherplace.net, should that link be:

相关标签:
8条回答
  • 2021-02-03 22:24

    As it is a governmental website, this is a tricky question. I regularly see disclaimers for external sites on these type of sites. I don't know if this is a standard or not.

    I think the answer is probably down to your own opinion, which should probably be based on usability and integrity.

    0 讨论(0)
  • 2021-02-03 22:25

    I think it totally depends on your use case.

    If you are opening a site in another domain and need to keep your site open, and I think in most cases you do, then use target='_blank'.

    As a user, I find it annoying when I click on a link to another domain and it moves me from the original domain. Of course, using ctrl+click in most browsers is a way to defend against this - but why make the user do more work?

    0 讨论(0)
  • 2021-02-03 22:26

    Just don't do it. Using target attributes with links presents complications for assistive technology users who may not know another tab has opened. It becomes a bad experience for these users when the back button does not work in the new tab to take them back to the page they started on. This practice can also be disorienting to people with cognitive disorders. It is best to let users decide where links will open.

    0 讨论(0)
  • 2021-02-03 22:27

    Just make two buttons for your users: One to open in new tab, and another to abandon the current page in favor of the linked page.

    [ www.google.com ] [Open Google in place of THIS page]

    0 讨论(0)
  • 2021-02-03 22:36

    You need to predict what your users want. Use target="_blank" if you expect your users will want to stay on the site.

    For example if a blog post has a link in the middle of the post, it makes sense to open that link in a new tab since you are expecting the reader to return to the page and continue reading.

    Some people argue that the reader could simply click "Back" when they wanted to come back to the page,

    But new webpages will have more links to webpages that have more links, what happens is that the reader has to "Back" a couple of times to get back to your blog post. Either that, or he ends up "lost" in the myriad of linked pages and couldn't come back to your blogpost (you can be sure that no one wants to open History and find your page again when they are "lost", unless there is a big incentive to coming back to your page).

    0 讨论(0)
  • 2021-02-03 22:39

    found this on the w3c site

    Checkpoints in this section:

    •10.1 Until user agents allow users to turn off spawned windows, do not cause pop-ups or other windows to appear and do not change the current window without informing the user. [Priority 2] Content developers should avoid specifying a new window as the target of a frame with target="_blank".

    More info here

    the question you need to ask your client is "To what priority level are you aiming to achieve?"

    0 讨论(0)
提交回复
热议问题