Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Target "_blank" not opening new window

Tags:

html

I have an image map with one of the following entry

<area shape="poly" tooltip="Canada"
    onmouseover="setAreaOver(this,'world_canvas','0,0,255','255,0,0','0.5',1,0,0);cvi_tip._show(event);"
    onmouseout="setAreaOut(this,'world_canvas',0,0);cvi_tip._hide(event);"
    onmousemove="getCoords(event,'map_of_world','map_of_world_6','world',32,371,800,400,1903,2876);cvi_tip._move(event);"
    href="http://someurl.com"
    target="_blank"
id="map_of_world_6">

UPDATED

I am using Google Chrome and I removed the coords attribute from the snippet because it is too long.

Upon clicking on the area the main page goes to the url instead opening on the new page. Is this the right way to use target=_blank?

like image 310
abiieez Avatar asked May 15 '13 08:05

abiieez


1 Answers

Your syntax for the target attribute is correct, but browsers need not honor it. They may interpret it as opening the destination in a new tab rather than new window, or they may completely ignore the attribute. Browsers have settings for such issues. Moreover, opening of new windows may be prevented by browser plugins (typically designed to prevent annoying advertisements).

There’s little you can do about this as an author. You might consider opening a new window with JavaScript instead, cf. to the accepted answer to target="_blank" is not working in firefox?, but browsers may be even more reluctant to let pages open new windows that way than via target.

like image 96
Jukka K. Korpela Avatar answered Oct 29 '22 02:10

Jukka K. Korpela