打开不带菜单栏的浏览器窗口(JavaScript?) [英] Open browser windows without menu bars (JavaScript?)

查看:93
本文介绍了打开不带菜单栏的浏览器窗口(JavaScript?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们社区中的用户希望在没有所有控制栏的小窗口中打开聊天.

The users in my community want the chat to be opened in a small window without all the control bars.

因此,我认为没有滚动条,位置栏,状态栏等的弹出窗口将是最佳解决方案.对吧?

So I think a popup window without scroll bars, location bar, status bar and so on would be the best solution. Right?

拥有这样一个弹出窗口的最佳方法是什么? JavaScript?我可以这样吗?

What is the best way to have such a popup window? JavaScript? Can I do it like this?

之间和

<script type="text/javascript">
<!--
var win = NULL;
onerror = stopError;
function stopError(){
    return true;
}
function openChat(){
    settings = "width=640, height=480, top=20, left=20, scrollbars=no, location=no, directories=no, status=no, menubar=no, toolbar=no, resizable=no, dependent=no";
    win = window.open('http://www.example.org/chat.html', 'Chat', settings);
    win.focus();
}
// -->
</script>

之间和

<a href="#" onclick="openChat(); return false">Open chat</a>

聊天室HTML

<form><input type="submit" value="Close chat" onClick="window.close()"></form>

推荐答案

如果您希望新窗口不包含菜单栏和工具栏,那么唯一的方法就是通过JavaScript,就像您自己提供的示例一样.但是请记住,当今大多数浏览器都忽略为状态栏设置的内容(始终显示它),并且可能被配置为也始终显示其余的工具栏.如果以这种方式配置了浏览器,则不会逃避它,尽管默认情况是应该只获得状态栏,也许只有地址栏.

If you want the new window not to have the menu bars and toolbars, the only way to do it is through JavaScript as with the example you provided yourself. However keep in mind that most browsers, nowadays, ignore what you set for the status bar (always show it) and may be configured to also always show the remaining toolbars. If a browser is configured in such a way there's no escaping it, although the default should be that you'll only get the status bar and perhaps the address bar.

这篇关于打开不带菜单栏的浏览器窗口(JavaScript?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆