I don't know if I'm doing this correctly. I have a little programming
experience in python, c++ and some others but this is my first time with
javascript. I'm trying have my website detect the user's browser and
assign a variable with different items if it's Internet Explorer. My
code works with firefox, opera and others but not IE.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitl ed Document</title>
<script language="JavaS cript" type="text/javascript"><!--
browser_version = parseInt(naviga tor.appVersion) ;
browser_type = navigator.appNa me;
//var sizex,sizey
if (browser_type == "Microsoft Internet Explorer") {
sizex=document. body.clientWidt h
sizey=document. body.clientHeig ht;
}
else {
sizex=window.ou terWidth-window.innerWid th
sizey=window.ou terHeight-window.innerHei ght;
}
alert ("width = " + sizex + "height = " + sizey)
// -->
</script>
</head>
There it is, I get the error on:(line 10)sizex=docume nt.body.clientW idth
Thanks for any help.
FF
experience in python, c++ and some others but this is my first time with
javascript. I'm trying have my website detect the user's browser and
assign a variable with different items if it's Internet Explorer. My
code works with firefox, opera and others but not IE.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitl ed Document</title>
<script language="JavaS cript" type="text/javascript"><!--
browser_version = parseInt(naviga tor.appVersion) ;
browser_type = navigator.appNa me;
//var sizex,sizey
if (browser_type == "Microsoft Internet Explorer") {
sizex=document. body.clientWidt h
sizey=document. body.clientHeig ht;
}
else {
sizex=window.ou terWidth-window.innerWid th
sizey=window.ou terHeight-window.innerHei ght;
}
alert ("width = " + sizex + "height = " + sizey)
// -->
</script>
</head>
There it is, I get the error on:(line 10)sizex=docume nt.body.clientW idth
Thanks for any help.
FF
Comment