| Click Here for Previous | JavaScript Tutorial Home | Click Here for Next |
|
|
||
The "Webtop Widget" is part of Netscape's collection of sample code. It's by Gary Smith. See their original web page at http://developer.netscape.com/docs/examples/javascript/webwidget/doc.html
The idea is to use the entire desktop as an undecorated canvas. In other words, to use the whole screen without any borders or scrollbars (a.k.a. "chrome). I thought this was pretty cool!Unfortunately this code does not work with Microsoft IE5 because it uses Netscape-specific extensions, including the "netscape" object. I haven't yet tried to make an IE version of this.
Using the form below, you specify the URL which you want opened on the "Webtop" and then submit.
Below is the code for the form. It simply calls the JavaScript function myWebtop(), passing it the URL that you supply.
<form name="myForm" onsubmit="myWebtop(this); return false;">
<input value="http://www.chipchapin.com/JavaScript/index.html">
<input type="SUBMIT" value="Open Webtop!">
</form>
|
The myWebtop() function is defined as follows:
var path =
"http://developer.netscape.com/docs/examples/javascript/webwidget/";
function myWebtop(form) {
if (location.replace && document.layers) {
location.replace(path + 'webtop.html?' + form.elements[0].value);
}
}
|
myWebtopsimply navigates to the Netscape webtop web page, passing the URL that you supplied as a "?" argument. For example, if you don't change the default URL, myWebtop will navigate to
http://developer.netscape.com/docs/examples/javascript/webwidget/webtop.html?http://www.chipchapin.com/JavaScript/index.htmlThere is a button on that page which will open a webtop page, along with some instructions. In an apparent bug, the Netscape web page seems to ignore the URL that you supply.
So far this doesn't illustrate much, except that it is possible to do this (at least with Netscape).
function openWebtopX(url) {
netscape.security.PrivilegeManager.enablePrivilege('CanvasAccess');
window.webtopWin = window.open(url || "http://developer.netscape.com",
'webtop',
'alwaysLowered=yes,outerWidth='+ screen.availWidth +',outerHeight='+ screen.availHeight +',left='+ screen.availLeft +',top='+ screen.availTop +',titlebar=no');
}
|
Note first of all the need to request 'CanvasAccess' from the netscape.security object. IE will fail at this point because, not surprisingly, it has no netscape object.
Next it simply opens a new window, window.open() takes three arguments: the URL to open, the window name ('webtop'), and an options string. The options string is where all the interesting stuff is.
Note that windows are created by default without scrollbars.
- Netscape's JavaScript Reference Manual
- See the section on window.open().
- Netscape "Webtop Widget" page
- The "Webtop Widget", by Gary Smith, is part of Netscape's collection of sample code.
| Click Here for Previous | JavaScript Tutorial Home | Click Here for Next |
|
|
|
|
|
|