你需要做的唯一窗口,默認情況下,瀏覽器提供了新窗口的名稱,但是當多個實例的window.open發生不會動態更新(源 - 第一行https://developer.mozilla.org/en-US/docs/Web/API/Window/open)。給他們唯一的名稱(與IDS的幫助),像這樣:
window.open('/path/to/page.php', 'UNIQUE_WINDOW1', 'width=300,height=400');
window.open('/path/to/page2.php', 'MORE_UNIQUE_WINDOW5', 'width=300,height=400');
如果不工作,你可以這樣做:
window.open('/path/to/page.php');
$.post('/path/to/page2.php', {}, function(res)
{
var win = window.open('', 'WINDOW_NAME', 'width=540,height=440');
with(win)
{
open();
write(res);
close();
}
});
這是什麼會做的是,沒有張貼到網頁,但資源返回該文件的輸出,因此您將window.open分配給一個變量,並用它打開它並將輸出寫入文件。 :)
你使用什麼瀏覽器?在鉻上工作得很好。 – George
[多窗口使用window.open()]可能的重複(https://stackoverflow.com/questions/18732775/multiple-windows-using-window-open) – zerek
我剛測試它,它適用於Chrome,但你必須啓用彈出窗口(地址欄的右側) – Paulooze