0

A quick question regarding URL target actions.

Is there a way to specify the target action of a URL within the URL?

Context: I can't edit the underlying code where links live in this particular instance, but I have full control over the links themselves. I'd like to be able to specify a link target (new tab, new window, same tab, etc) from a URL itself.


If that's possible, awesome! If that's impossible, darn (and thank you for enlightening me).

SethGoodluck
  • 380
  • 3
  • 14
  • Are you asking whether or not you can add something like `target="_blank"`? You need to show us an example of what you are trying to do. Also, if that is the case it can be done and through JS – Adjit Sep 22 '16 at 18:51
  • It's not possible to add the target itself to the URL. The target attributes are defined in the href TAG: URL – stefan Sep 22 '16 at 18:56
  • Note that opening new windows or tabs without explicit user wish is generally bad practice. – Marat Tanalin Sep 22 '16 at 19:01

1 Answers1

0

There's no reliable way as far as I'm aware (it's a security concern). If you only have control of the URL because you're using some other system (you're not the admin), chances are the link is escaped for javascript. If it isn't:

<a href="javascript:window.open('https://example.com', '_blank')">Some link</a>
noahnu
  • 3,479
  • 2
  • 18
  • 40