2008
08-4
08-4
检测浏览器类型,主要根据 userAgent关键字来确定
- function __navigator()
- {
- this.value = false; //返回值 ie 0 firefox 1 other 2
- this.useragent = navigator['userAgent'];
- if(this.useragent.indexOf('MSIE')>0)
- {
- this.value = 0;
- }
- else if(this.useragent.indexOf('Firefox')>0)
- {
- this.value = 1;
- }
- else
- {
- this.value = 2;
- }
- }
获得浏览器相关信息
- function __window()
- {
- this.innerwidth = 0; //document width
- this.innerheight = 0; //document height
- this.outerwidth = 0; //browser width
- this.outerwidth = 0; //browser height
- this.screenx = 0; //browser position x
- this.screeny = 0; //browser position y
- /*@cc_on
- @if(@_jscript)
- this.innerwidth = document.body.clientWidth;
- this.innerheight = document.body.clientHeight;
- this.outerwidth = document.documentElement.clientWidth;
- this.outerheight = document.documentElement.clientHeight;
- this.screenx = window.screenLeft;
- this.screeny = window.screenTop;
- @else*/
- this.innerwidth = window.innerWidth;
- this.innerheight = window.innerHeight;
- this.outerwidth = window.outerWidth;
- this.outerheight = window.outerHeight;
- this.screenx = window.screenX;
- this.screeny = window.screenY;
- /*@end
- @*/
- }