HTML and CSS Reference
In-Depth Information
browser
=
navigator
.
platform
;
document
.
write
(
showAddress
);
document
.
write
(
cr
);
document
.
write
(
query
);
document
.
write
(
fate
);
document
.
write
(
cr
);
document
.
write
(
browser
);
</script>
<
meta http
-
equiv
=
”Content-Type”
content
=
”text/html; charset=UTF-8”
>
<
title
>
Simple Variable
</
title
>
</
head
>
<
body
>
</
body
>
</
html
>
Depending on the type of computer you use, the browser variable's value will be dif erent. (It
certainly varies.) h e page was run on both a Windows 7 and Macintosh computer to see how
one variable varied. Figure 12-4 shows the dif erent output from the same program.
247
Figure 12-4: Displaying variable computer types on the screen.
h e variable value,
navigator.platform
is an object. h e
navigator
object has a
property,
platform
, that tells what type of computer the browser is running on. In testing the
program in Windows 7 (refer to the top panel in Figure 12-4) with a 64-bit operating system,
the results show
Win32
. h at's because the browsers tested were 32-bit, including an early
version of Internet Explorer 9. h e
MacIntel
results (refer to the bottom panel in Figure
12-4) were on a Macintosh computer with an Intel processor displayed on an Opera browser.