2013-10-31 77 views
1

爲什麼這個鏈接在Safari上不起作用? 當我點擊Click here它應該打開http://othersite.comhttp://mysite.com/profile。問題是它只會打開http://mysite.com/profile並且它不會爲http://othersite.com打開一個新選項卡。這一個適用於Chrome和firefox ..我可以使它在Safari上工作嗎?帶onclick的href在Safari中不工作

HTML

<a target="_blank" onclick="redirect()" href="http://othersite.com">Click here</a> 

的JavaScript

function redirect(){ 
    location.href = 'http://mysite.com/profile'; 
} 

回答

0

而且爲了在你設置目標屬性_tab一個新的選項卡打開鏈接,_blank打開一個新標籤或取決於用戶的設置的新窗口。

+1

這甚至沒有接近回答這個問題。另外它不起作用。 – DirtyKalb