3 ms·
The reader should decide. It’s usually trivial to hold down a modifier key to open a link in a new tab or window, but if the `target` attribute is set in the li
by leephillips 4y ago
The reader should decide. It’s usually trivial to hold down a modifier key to open a link in a new tab or window, but if the `target` attribute is set in the link it’s not as easy to override it.
This debate raged in the early days of the web: what is the better practice? A consensus emerged among web designers that leaving it to the reader makes more sense. I’m proud that I convinced J. Zeldman that his early practice of using `target='_blank'` hurt the user’s navigation, and so played a minuscule part in nudging designers in general away from this.
- zo1 4y agoUnfortunately, with the advent of SPAs, Web3.0 and the takeover of the web by Angular and friends, we can no longer rely on "links" behaving that way. For the time-being, we've lost that battle and the web is worse-off as a result. I.e. A lot of the time, links are actually various DOM elements that have onclick handlers and various JS-fuckery meant to obfuscate true behavior from the user and make it more difficult for the user to control the browser. Worse still, how about the user-hostile behavior of browsers that now allow JS to takeover and disable right-click, select and copy functions.
- ElectricalUnion 4y agoWorse than that, even if you somehow try to force onclick handlers to not obfuscate true behavior, most truly bad SPAs don't even have valid intermediary states accessible thru URLs; the only way to navigate the "application" is sometimes by changing the state with interactive SPA use.
- cratermoon 4y agoYes, deep-linking with SPAs is mostly broken. This came up here a few weeks ago. (https://news.ycombinator.com/item?id=34896472 https://news.ycombinator.com/item?id=34896472) Someone defended SPAs by pointing out that frameworks like React use Javascript and browser APIs to fake paths and history, and another noted that reimplementing basic browser functionality was madness.