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

Anb*_*nbu 51 address-bar firefox

希望有人能提供帮助.只是无法在没有地址栏的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);
Run Code Online (Sandbox Code Playgroud)

我需要为所有浏览器制作

Int*_*ual 74

Firefox 3.0及更高版本location默认禁用设置.resizable并且status默认情况下也被禁用.您可以通过在地址栏中键入"about:config"并按"dom"过滤来验证这一点.感兴趣的项目是:

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

您可以在Mozilla开发者网站上获得更多信息.但这基本上意味着你将无法做你想做的事.

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

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');
Run Code Online (Sandbox Code Playgroud)

  • Mozilla有充分理由禁用此功能. (20认同)

cat*_*try 12

检查window.open上mozilla文档.窗口功能("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");
Run Code Online (Sandbox Code Playgroud)

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

  • 标题栏没有隐藏.检查IE,FF,Chrome和Opera (4认同)
  • 位置栏未隐藏 (2认同)

Gau*_*pta 10

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


PAR*_*HAN 8

我知道这是一个非常老的问题,是的,我同意我们不能在现代浏览器中隐藏地址栏,但是我们可以在地址栏中隐藏网址(例如show url 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);
Run Code Online (Sandbox Code Playgroud)