为什么此链接无法在Safari上运行?
当我点击Click here
时,它应该会打开http://othersite.com
以及http://mysite.com/profile
。问题是它只会打开http://mysite.com/profile
并且不会为http://othersite.com
打开新标签页。这个适用于Chrome和firefox ..我可以在Safari上使用吗?
HTML
<a target="_blank" onclick="redirect()" href="http://othersite.com">Click here</a>
的javascript
function redirect(){
location.href = 'http://mysite.com/profile';
}
答案 0 :(得分:-2)
要在新标签页中打开链接,您必须将目标属性设置为_tab
,_blank
会根据用户的设置打开新标签页或新窗口。