看看在使用Shift鍵,防止瀏覽器:http://jsfiddle.net/casaschi/qKD9q/的javascript:這個例子用window.open
<div style="color:blue;" onclick="window.open('http://www.google.com/search?q=' + Math.random(), '_blank');">
click me while pressing the shift key and then while NOT pressing it
</div>
<br/>
does one window appear as popup and the other one as a new tab?
如果你點擊在Chrome或IE瀏覽器的藍線,一個新的標籤將打開。 如果在藍線上按住Shift並單擊,則會彈出一個彈出窗口。
有沒有一種方法可以從我的javascript代碼控制如何打開新窗口,例如總是作爲新窗口,而不管用戶是否按下ShiftKey?
謝謝。