The users in my munity 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?
What is the best way to have such a popup window? JavaScript? Can I do it like this?
BETWEEN AND
<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('.html', 'Chat', settings);
win.focus();
}
// -->
</script>
BETWEEN AND
<a href="#" onclick="openChat(); return false">Open chat</a>
ON CHAT.HTML
<form><input type="submit" value="Close chat" onClick="window.close()"></form>
The users in my munity 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?
What is the best way to have such a popup window? JavaScript? Can I do it like this?
BETWEEN AND
<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/chat.html', 'Chat', settings);
win.focus();
}
// -->
</script>
BETWEEN AND
<a href="#" onclick="openChat(); return false">Open chat</a>
ON CHAT.HTML
<form><input type="submit" value="Close chat" onClick="window.close()"></form>
Share
Improve this question
asked Jan 17, 2010 at 15:32
cawcaw
31.5k64 gold badges184 silver badges293 bronze badges
1
- I generally don't like popups, but if you're sure your users do, why not? – Douwe Maan Commented Jan 17, 2010 at 15:36
3 Answers
Reset to default 3If 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.
Your solution is good, but there are alternatives. You can create the window by your own, as some kind of layer. Then you need to implement lots of things but it gives you full control over window Look And Feel. Of course you can always use some scripts like jQuery UI Dialog.
In short, you can't control everything that the browser displays in a pop-up window. Most browsers keep the URL visible, for example. This page explains most of the details (though it is a couple years old).