T
Trevor L.
I have obtained some browser sniffers from various sources on the net. I
note that Murray makes use of these (or parts of them)
e.g.
<script type="text/javascript">
function print_page(where){
var is_mac=(navigator.platform.indexOf("ac") != -1);
(document.all && is_mac)?
alert("Select \"Print\" from the menu") : where? where.window.print() :
window.print();
}
</script>
I have a script like this (from a good source on the net)
var browser = new Browser()
function Browser()
{ // the now standard browser sniffer class
this.dom = (document.getElementById) ? 1: 0
this.ie4 = (document.all && !this.dom) ? 1: 0
this.ns4 = (document.layers && !this.dom) ? 1: 0
this.ns6 = (this.dom && !document.all) ? 1: 0
this.ie5 = (this.dom && document.all) ? 1: 0
this.ok = (this.dom||this.ie4||this.ns4)
this.platform = navigator.platform
this.is_mac = (this.platform.indexOf("ac") != -1);
}
However, I find that it returns a Javascript error "document" is undefined
referring to the first line in the function
Why is it so?
Can I rewrite this to get rid of the JS error?
--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au
I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html
note that Murray makes use of these (or parts of them)
e.g.
<script type="text/javascript">
function print_page(where){
var is_mac=(navigator.platform.indexOf("ac") != -1);
(document.all && is_mac)?
alert("Select \"Print\" from the menu") : where? where.window.print() :
window.print();
}
</script>
I have a script like this (from a good source on the net)
var browser = new Browser()
function Browser()
{ // the now standard browser sniffer class
this.dom = (document.getElementById) ? 1: 0
this.ie4 = (document.all && !this.dom) ? 1: 0
this.ns4 = (document.layers && !this.dom) ? 1: 0
this.ns6 = (this.dom && !document.all) ? 1: 0
this.ie5 = (this.dom && document.all) ? 1: 0
this.ok = (this.dom||this.ie4||this.ns4)
this.platform = navigator.platform
this.is_mac = (this.platform.indexOf("ac") != -1);
}
However, I find that it returns a Javascript error "document" is undefined
referring to the first line in the function
Why is it so?
Can I rewrite this to get rid of the JS error?
--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au
I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html