window.open仅在Firefox中打开
window.open only in Firefox?
如果这是一个重复的问题,很抱歉!
我有下面的Javascript,它在Firefox中运行良好,并产生一个弹出窗口。然而,在IE 9中,它什么都不做,在Chrome中,它就像一个链接,可以更改当前页面!
非常感谢您的建议!
window.open(page,name,'width='+width+', height='+height+',location=yes,menubar=no,resizable=no,toolbar=no,scrollbars=yes');
提前谢谢。
这是的一个工作示例
JS
function openWindow()
{
var width=668;
var height=548;
var page="http://google.com";
window.open(page, "awindow", "width="+width+",height="+height+",location=yes,scrollbars=yes, resizable=yes");
}
HTML
<a href="javascript:openWindow()">Open</a>
演示
您是否正确创建了变量?
这个代码对我有效:
var page = 'page.php';
var name = 'pagename';
var width = 200;
var height = 100;
window.open(page,name,'width='+width+', height='+height+',location=yes,menubar=no,resizable=no,toolbar=no,scrollbars=yes');
编辑
在我的网络应用程序中,我使用以下功能打开窗口。它应该适用于所有浏览器。
function wopen(url, name, w, h, scrollb) {
scrollb = typeof(scrollb) != 'undefined' ? scrollb : 'no';
w += 32;
h += 96;
wleft = (screen.width - w) / 2;
wtop = (screen.height - h) / 2;
var win = window.open(url, name,
'width=' + w + ', height=' + h + ', ' + 'left=' + wleft + ', top=' + wtop + ', ' +
'location=no, menubar=no, ' +
'status=no, toolbar=no, scrollbars=' + scrollb + ', resizable=yes');
// Just in case width and height are ignored
win.resizeTo(w, h);
// Just in case left and top are ignored
win.moveTo(wleft, wtop);
win.focus();
}
您在哪里调用window.open
?IE9将阻止调用,如果它们是在页面加载过程中作为弹出窗口阻止程序的一部分进行的。Chrome做了类似的事情,但将新窗口重定向到主选项卡(从而让用户控制)。至于Firefox。。。检查您的FF弹出窗口阻止程序设置。
相关文章:
- 直接下载文件,而不是从window.open(url)
- 使用window.open后,window.close无法在firefox中工作
- window.open在firefox上工作,而不是在chrome上
- window.open仅在Firefox中打开
- jQuery 'prop' 在 FireFox 中无法在详细信息的 'open' 属性上工作
- window.open 在 Firefox 上遇到了问题
- firefox javascript window.open _self
- 'window.open' blocked by Firefox
- onclick window.open (Firefox)
- Open在Firefox中不是一个函数,但它在Chrome中可以工作
- Firefox中的open()和window.open()有什么区别
- window.open(url,windowname,opts)在新选项卡中打开,而不是在Firefox中打开新窗口
- 在 Firefox 上,window.open(url) 和 window.location.href = url 有什
- window.open浏览器在Firefox和Chrome中的问题
- Window.open打开一个选项卡,而不是firefox和safari中的窗口
- Javascript Onclick window.open Popup在Firefox和Safari中不起作用
- 在window.open()上运行Firefox扩展
- 窗口.open可以在Firefox中使用,但不能在IE或Chrome中使用
- firefox在window.open时未启动$(document).ready(function)
- firefox调用window.open时出现问题