问题描述
我一直在开发一个网络应用程序,其中的一部分我需要打开一个新窗口.我在所有浏览器上都可以使用它,我的症结在于谷歌浏览器.
I have been working on a web app and for part of it I need to open a new window. I have this working on all browsers, my sticking point is with Google Chrome.
Chrome 似乎忽略了导致我出现问题的窗口功能,我遇到的问题是我需要在新窗口中可以编辑地址栏.FF、IE、Safari 和 Opera 可以做到这一点,而 Chrome 则不然.
Chrome seems to ignore the window features which is causing me issues, the thing I'm struggling with is I need the address bar to be editable within the new window. FF, IE, Safari and Opera do this fine, Chrome does not.
我的代码:
function popitup(url) {
newwindow=window.open(url, 'name', 'toolbar=1,scrollbars=1,location=1,statusbar=0,menubar=1,resizable=1,width=800,height=600');
if (window.focus) {
newwindow.focus()
}
return false;
}
推荐答案
其他答案已经过时.Chrome for window.open
的行为取决于调用它的位置.另请参阅本主题.
The other answers are outdated. The behavior of Chrome for window.open
depends on where it is called from. See also this topic.
当从通过用户操作(例如 onclick 事件)触发的处理程序调用 window.open
时,它的行为类似于 ,默认情况下在新选项卡中打开.但是,如果在别处调用
window.open
,Chrome 会忽略其他参数并始终打开一个带有不可编辑地址栏的新窗口.
这篇关于谷歌浏览器“window.open"解决方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!