目标“_blank”不打开新窗口 [英] Target "_blank" not opening new window

查看:93
本文介绍了目标“_blank”不打开新窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有以下条目之一的图像映射:

 < area shape =polytooltip =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>

已更新

我使用的是谷歌浏览器,我从代码片段中删除了 coords 属性,因为它太长了。

点击该区域后,主页面会转到网址,而不是在新页面上打开。这是正确的方式来使用 target = _blank

解决方案

target 属性的语法是正确的,但浏览器不需要遵守它。他们可能会将其解释为在新标签中打开目的地而不是新窗口,或者他们可能会完全忽略该属性。浏览器有这些问题的设置。此外,新窗口的打开可能会被浏览器插件阻止(通常旨在防止烦人的广告)。

对于作为作者的您几乎没有什么可做的。您可以考虑使用JavaScript来打开一个新窗口,参见参考资料。到 target =_blank的接受答案在Firefox中不工作?,但浏览器可能更不愿意让页面打开新窗口,而不是通过 target


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?

解决方案

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.

这篇关于目标“_blank”不打开新窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆