Add image after external link. Link opens in parent window, image opens the same link but in new window. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Add image after external link. Link opens in parent window, image opens the same link but in new window.

I'm really struggling with this, and I just realized this can't be done with HTML and CSS alone. Can anyone help? I have an offsite (external) link that will open in the parent window. After that offsite link (and every other offsite link), I want to add an image (a little icon). The image should also be a link (the same link), but it should open in a new window rather than in the parent one. Kind of giving the user an opportunity to open the link in the same or a new window. Is this easy to achieve?

23rd Mar 2018, 3:35 PM
Spise Pause
Spise Pause - avatar
3 Answers
+ 1
Just use target on the anchor link. target="blank" etc.
23rd Mar 2018, 3:58 PM
ihateonions
+ 1
That's not quite what I want
23rd Mar 2018, 4:01 PM
Spise Pause
Spise Pause - avatar
+ 1
use 2 links (1offsite link +1 icon link) with different targets as @ihateonions suggested. below more target options for you to experiment with: https://www.w3schools.com/tags/att_a_target.asp
23rd Mar 2018, 9:22 PM
seamiki
seamiki - avatar