Entry
How do you open a window without a titlebar?
Sep 28th, 2003 16:30
Simon Robertson, Klaus Bolwin, Martin Honnen, James Stubblefield,
---
With IE (not sure about other browsers) you can also do this simply by
opening a window in full-screen mode and then make the opened window
resize itself.
For example open the window with..
window.open('test.htm','','fullscreen=yes');
In the test.htm file have a bit of JS in the <head> of the page that
resizes the window..
window.resizeTo(400,300);
That should do the trick. Like I said though I'm not sure if this will
work for non-IE browsers but you can give it a try.
---
This is only possible with code that is regarded as trusted. With NN
that means the code needs to successfully request the privilege to do
so, with IE only a html application (.hta) is regarded as trusted.
The code for NN4:
netscape.security.PrivilegeManager.enablePrivilege
('UniversalBrowserWrite');
var w = open ('', 'windowName', 'width=300,height=300,titlebar=0');
w.document.open();
w.document.write('<HTML><BODY><A HREF="javascript: window.close
();">close<\/A>');
w.document.close();
Note that code requesting a privilege might need to be signed if loaded
via http: to work successfully.
For IE put the following into an .hta file:
var w = open ('', 'windowName', 'width=300,height=300,titlebar=0');
w.document.open();
w.document.write('<HTML><BODY><A HREF="javascript: window.close
();">close<\/A>');
w.document.close();
In Mozilla you can use XUL to open a chromeless window:
1. you must force your server to handel *.xul file in a correct way,
normally these files are treated as plain text.
To do this, you can e.g. add the following directive to your .htaccess
file:
AddType application/vnd.mozilla.xul+xml xul
2. open a new window and load the *.xul file:
<a href="http://www.yourdomain.com/path/testxul.xul" onclick="nasowas =
window.open('http://www.yourdomain.com/path/testxul.xul', 'bmarks',
'chrome,width=600,height=300'); return false;">test</a>
3. the file testxul.xul contains the following commands:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!DOCTYPE window>
<window
id="browser-window"
title="Test Files"
orient="vertical"
hidechrome="true"
screenX="200"
screenY="100"
width="800"
height="500"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<iframe id="content-body" src="http://www.yourdomain.com" flex="1"/>
</window>
Since this is basicly not only a new window but a new browser
application you can add your own tool- and menubars as well as a history
module, buttons etc.