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

问题描述 投票:0回答:2

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

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

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

的test.html:

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

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

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

javascript html linux firefox window.open
2个回答
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);

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

© www.soinside.com 2019 - 2024. All rights reserved.