[JavaScript] 解決window.open()打開同一個URL沒能在兩個網頁中打開

在html中某按鈕的onclick事件綁定代碼如下:

window.open("http://localhost:8080/appdemo/account.html?" + new Date().getTime(), "賬戶資料")。

結果發現再次點擊該按鈕時沒能在兩個網頁中打開。

經過一翻折騰,終於發現原因,就是window.open函數的target參數得用不同的值或者_blank。

具體代碼如下:window.open("http://localhost:8080/appdemo/account.html?" + new Date().getTime(), "_blank")

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章