Hi koalb,
the script you are looking for might look like this one:
<HTML>
<HEAD>
<TITLE> Window Resizing Test </TITLE>
<script language="JavaScript">
<!--
br=navigator.appName;
brversion=parseInt(navigator.appVersion);
x1=100;
y1=100;
x2=200;
y2=200;
x3=300;
y3=300;
if (br=="Netscape" && brversion>=4)
{
window.resizeTo(x1,y1);
alert("Navigator");
}
else
{
if (br=="Microsoft Internet Explorer")
{
window.resizeTo(x2,y2);
alert("IE");
}
else
{
window.resizeTo(x3,y3);
alert(br);
}
}
//-->
</script>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<h1>test</h1>
</BODY>
</HTML>
I have included a link in the additional sources section that shows
how exactly you can detect other browsers than the ones you asked in
your question. I have also added alerts, so you can see that the
browser detection works correctly.
I hope this helps. If you have any problems with the script or require
additional information, feel free to request a clarification at any
time.
voyager-ga
Additional Sources
The Ultimate JavaScript Client Sniffer, Version 3.03:
http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
Search Strategy
resize window javascript
://www.google.com/search?sourceid=navclient&q=resize+window+javascript
javascript browser version
://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=javascript+browser+version |
Request for Answer Clarification by
koalb-ga
on
17 Jan 2003 08:45 PST
Thanks! It worked great!
I'm using this with Dreamweaver's wysiwyg java plugins and was just
curious to know if I've "integrated" your js as
efficiently/effectively as possible. Remember, I know just enough to
be dangerous.
<script language="JavaScript" type="text/JavaScript">
<!--
//tmtC_Resize_Window
br=navigator.appName;
brversion=parseInt(navigator.appVersion);
if (br=="Netscape" && brversion>=4)
{
window.resizeTo(800,600);
}
else
{
if (br=="Microsoft Internet Explorer")
{
window.resizeTo(822,634);
}
else
{
window.resizeTo(800,600);
}
} //tmtC_Resize_WindowEnd
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;
i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image;
d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr;
for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array;
for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc)
x.oSrc=x.src; x.src=a[i+2];}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
|
Request for Answer Clarification by
koalb-ga
on
17 Jan 2003 15:10 PST
Thanks! It worked great!
I'm using this with Dreamweaver's wysiwyg java plugins and was just
curious to know if I've "integrated" your js as
efficiently/effectively as possible. Remember, I know just enough to
be dangerous.
<script language="JavaScript" type="text/JavaScript">
<!--
//tmtC_Resize_Window
br=navigator.appName;
brversion=parseInt(navigator.appVersion);
if (br=="Netscape" && brversion>=4)
{
window.resizeTo(800,600);
}
else
{
if (br=="Microsoft Internet Explorer")
{
window.resizeTo(822,634);
}
else
{
window.resizeTo(800,600);
}
} //tmtC_Resize_WindowEnd
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;
i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image;
d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr;
for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array;
for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc)
x.oSrc=x.src; x.src=a[i+2];}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
|
Clarification of Answer by
voyager-ga
on
17 Jan 2003 17:05 PST
Hi koalb,
thank you for the good rating and the tip! As to the way you
integrated the javascript into your page - that's fine. You basically
can't do anything wrong as long as you leave the part fairly at the
top of the <head> section, so it's among the first things that happen.
That way you won't have the resizing interfere with anything that you
might want to do later on in the javascript section.
At the moment this is not really an issue anyways because all the
other javascript parts are just functions that will (probably?) be
called from somewhere in the <body> section much later on.
If you run into any trouble with it, don't hesitate to request further
clarifications!
Thank you,
voyager-ga
|