在firefox&中打开没有地址栏的新弹出窗口IE

时间:2010-05-26 01:32:04

标签: firefox address-bar

希望有人可以提供帮助。只是无法在没有地址栏的Firefox中打开新窗口。 IE可以正常使用以下代码

window.open('/pageaddress.html', 'winname', 
  directories=0,titlebar=0,toolbar=0,location=0,status=0,     
    menubar=0,scrollbars=no,resizable=no,
      width=400,height=350);

我需要为所有浏览器制作

6 个答案:

答案 0 :(得分:71)

默认情况下,Firefox 3.0及更高版本已禁用设置location。默认情况下,resizablestatus也会被停用。您可以通过在地址栏中键入“about:config”并按“dom”过滤来验证这一点。感兴趣的项目是:

  • dom.disable_window_open_feature.location
  • dom.disable_window_open_feature.resizable
  • dom.disable_window_open_feature.status

您可以在Mozilla Developer网站上获取更多信息。但这基本上意味着你将无法做你想做的事。

你可能想要做的一件事(虽然它不能解决你的问题),在你的窗口特征参数周围加上引号,如下所示:

window.open('/pageaddress.html','winname','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=350');

答案 1 :(得分:12)

检查mozilla documentation on window.open。 窗口特征(“directory = ...,...,height = 350”)等参数应该是一个字符串:

window.open('/pageaddress.html','winname',"directories=0,titlebar=0,toolbar=0,location=0,status=0,menubar=0,scrollbars=no,resizable=no,width=400,height=350");

尝试在浏览器中使用。请注意,某些功能可能会被用户首选项覆盖,例如“location”(请参阅​​文档)

答案 2 :(得分:9)

解决方法 - 打开模式弹出窗口并将外部URL嵌入为iframe。

答案 3 :(得分:5)

我知道这是一个非常老的问题,是的,我同意我们无法在现代浏览器中隐藏地址栏,但是我们可以在地址栏中隐藏网址(例如,显示网址about:blank),以下是我的工作解决方案周围。

var iframe = '<html><head><style>body, html {width: 100%; height: 100%; margin: 0; padding: 0}</style></head><body><iframe src="https://www.w3schools.com" style="height:calc(100% - 4px);width:calc(100% - 4px)"></iframe></html></body>';

var win = window.open("","","width=600,height=480,toolbar=no,menubar=no,resizable=yes");
win.document.write(iframe);

答案 4 :(得分:3)

在Internet Explorer中,如果新网址来自与当前网址相同的域名,则该窗口将打开而不显示地址栏。否则,它将导致出现地址栏。一种解决方法是从同一个域打开一个页面,然后从该页面重定向。

答案 5 :(得分:0)

检查这是否有效它对我来说很好

<script>
  var windowObjectReference;
  var strWindowFeatures = "menubar=no,location=no,resizable=no,scrollbars=no,status=yes,width=400,height=350";

     function openRequestedPopup() {
      windowObjectReference = window.open("http://www.flyingedge.in/", "CNN_WindowName", strWindowFeatures);
     }
</script>