Javascript window.open()工具栏=没有功能

时间:2012-09-04 17:55:08

标签: javascript html linux firefox window.open

我试图在firefox中打开一个html文件,只需要很少的额外内容(工具栏,菜单栏,地址栏等)。只是网页的html内容,没有别的。我希望能够在终端的Linux中做到这一点。我还必须这样做,它可以在运行相同版本的Firefox的多台Linux机器上运行。因此,这消除了使用配置文件的任何可能性。我希望firefox有一个简单的参数可以让我关闭这些设置。我不相信有。

我找到的唯一可能是通过javascript的window.open。看来window.open的参数规范甚至不能在 firefox 1.5.0.9 中运行。我已经读过他们中的一些在firefox 3.0+中删除了,但是没有找到关于我正在使用的版本的任何内容,1.5.0.9。

这是我使用windows.open打开我的.html文件...

的test.html:

    <html>
    <body>
    <script>
    window.open('./rel_notes.html','_self','toolbar=no,menubar=no')
    </script>
    </body>
    </html>

然后从终端运行'firefox test.html'。

当我这样做时,工具栏和菜单栏仍然会出现。我究竟做错了什么?有更简单的方法吗?

2 个答案:

答案 0 :(得分:0)

如果您的浏览器设置允许弹出窗口没有来自X源的通知(localhost我假设?),则以下内容可能有效:


window.open('./rel_notes.html',null,'menubar=no,toolbar=no');
window.open('','_self',''); //this is needed to prevent IE from asking about closing the window.
setTimeout('self.close();',500);

答案 1 :(得分:0)

取自链接中的链接bungdito给了我:

    After a window is opened, JavaScript can't be used to change the features. 

因此,通过打开test.html,然后在_self上使用window.open,我正在尝试使用javascript将功能调整到已经打开的窗口。

来源:https://developer.mozilla.org/en-US/docs/DOM/window.open