使用窗口打开新窗口.打开方式"Post"参数



我想使用 window.open()打开一个新窗口。 但问题是我不想向用户显示 URL,所以我必须为此使用 POST URL。 但是 window.open() 函数打开新窗口并在 URL 栏中显示 URL。 我必须隐藏网址。

这是示例:

window.open(URL,"_blank",'status=0,toolbar=0,resizable=0,menubar=0,titlebar=0,width=1180,height=770');

不,您无法在现代浏览器中隐藏地址栏。

位置=无参数将不起作用。 请参阅 MDN 文档。 https://developer.mozilla.org/en-US/docs/Web/API/Window/open

在 Firefox 3 中,dom.disable_window_open_feature.location现在默认为 没错,强制存在位置栏,就像在IE7中一样。

位置参数也始终在谷歌浏览器中启用(表示位置=是)。


但是您可以分配一个虚假的网址:

var win = window.open('/path/page.htm');
win.addEventListener('DOMContentLoaded', function () {
win.history.replaceState(null, null, '/fake.htm');   // must be same domain (or ignore domain)
});

相关内容

最新更新