Browser对象

Window对象
即浏览器中打开的窗口,当文档里面有框架(frame或者iframe标签)时,浏览器会为HTML文档创建一个window对象,并为每个框架创建一个额外的window对象。

属性
closed //返回窗口是否已被关闭
defaultStatus //设置或返回窗口状态栏中的默认文本
document //对Document对象的只读引用
history //对History对象的只读引用
innerheight //返回窗口的文档县市区的宽度,IE中的表示方法不同。
innerwidth //返回窗口的文档显示区的宽度
location //用于窗口或框架的Location对象
name //设置或返回窗口的名称
Navigator //对Navigator对象的只读引用
opener //返回对创建此窗口的窗口的引用,只有表示顶层窗口的window对象的opener属性才有效,表示框架的Window对象的opener属性无效
outerheight //返回窗口的外部高度
outwidth //返回窗口的外部宽度
Screen //对Screen对象的只读引用
status //设置窗口状态栏的文本
top //返回最顶层的先辈窗口

方法
alert() //显示带有一段消息和一个确认按钮的警告框
blur() //把键盘焦点从底层窗口移开
clearInterval() //取消由setInterval()设置的timeout,参数是setInterval()返回的ID值。
clearTimeout() //取消由setTimeout()方法设置的timeout
close() //关闭浏览器窗口,只有通过JavaScript代码打开的窗口才能够由JavaScript代码关闭。
confirm() //显示带有一段消息以及确认按钮和取消按钮的对话框
createPopup() //创建一个pop-up窗口
focus() //把键盘焦点给予一个窗口
moveBy() //可相对窗口的当前坐标把它移动制定的像素
moveTo() //把窗口的左上角移动到一个指定的坐标
open() //打开一个新的浏览器窗口或查找一个已命名的窗口
print() //打印当前窗口的内容
prompt() //显示可提示用户输入的对话框
resizeBy() //按照制定的像素调整窗口的大小
resizeTo() //把窗口的大小调整到指定的宽度和高度
scrollBy() //按照指定的像素值来滚动内容
scrollTo() //把内容滚动到指定的目标
setInterval() //按照指定周期来调用函数或计算表达式
setTimeout() //在指定的毫秒数后调用函数或表达式


Navigator对象

包含有关浏览器的信息
集合:plugins[] //Plugin对象数组,其中元素代表浏览器已经安装的插件。

属性
appCodeName //返回浏览器的代码名,navigator.appCodeName

[查看有关浏览器信息:
<html>
<body>
<script type="text/javascript">
document.write("<p>浏览器:")
document.write(navigator.appName + "</p>")

document.write("<p>浏览器版本:")
document.write(navigator.appVersion + "</p>")

document.write("<p>代码:")
document.write(navigator.appCodeName + "</p>")

document.write("<p>平台:")
document.write(navigator.platform + "</p>")

document.write("<p>Cookies 启用:")
document.write(navigator.cookieEnabled + "</p>")

document.write("<p>浏览器的用户代理报头:")
document.write(navigator.userAgent + "</p>")
</script>
</body>
</html>]

appMinorVersion //返回浏览器的次级版本
appName //浏览器的名称
appVersion //浏览器的平台和版本信息
browserLanguage //当前浏览器的语言
cookieEnabled //知名浏览器中是否启用cookie的布尔值
cpuClass //浏览器的CPU等级
onLine //指明系统是否处于脱机模式的布尔值
platform //运行浏览器的操作系统凭条
systemLanguage //返回OS使用的默认语言
userAgent //返回由客户机发送服务器的user-agent头部的值
userLanguage //返回OS的自然语言设置

方法
javaEnabled() //规定浏览器是否启用JAVA
taintEnabled() //规定浏览器是否启用数据污点(data tainting)


Screen对象
包含有关客户端显示屏幕的信息

属性
调用有关用户屏幕信息:
<script type="text/javascript">
document.write("Screen resolution: ")
document.write(screen.width + "*" + screen.height)
document.write("<br />")
document.write("Available view area: ")
document.write(screen.availWidth + "*" + screen.availHeight)
document.write("<br />")
document.write("Color depth: ")
document.write(screen.colorDepth)
document.write("<br />")
document.write("Buffer depth: ")
document.write(screen.bufferDepth)
document.write("<br />")
document.write("DeviceXDPI: ")
document.write(screen.deviceXDPI)
document.write("<br />")
document.write("DeviceYDPI: ")
document.write(screen.deviceYDPI)
document.write("<br />")
document.write("LogicalXDPI: ")
document.write(screen.logicalXDPI)
document.write("<br />")
document.write("LogicalYDPI: ")
document.write(screen.logicalYDPI)
document.write("<br />")
document.write("FontSmoothingEnabled: ")
document.write(screen.fontSmoothingEnabled)
document.write("<br />")
document.write("PixelDepth: ")
document.write(screen.pixelDepth)
document.write("<br />")
document.write("UpdateInterval: ")
document.write(screen.updateInterval)
document.write("<br />")
</script>

availHeight //返回显示屏幕的高度(除Windows任务栏之外)
availWidth //返回显示屏幕的宽度(除Windows任务栏之外)
bufferDepth //设置或返回调色板的比特深度
colorDepth //返回目标设备或缓冲器上的调色板的比特深度
deviceXDPI //返回显示屏幕的每英寸水平点数
deviceYDPI //返回显示屏幕的每英寸垂直点数
fontSmoothingEnabled //返回用户是否在显示控制面板中启用了字体平滑
height //返回显示屏幕的高度
logicalXDPI //返回显示屏幕每英寸的水平方向的常规点数
logicalYDPI //返回显示屏幕每英寸的垂直方向的常规点数
pixelDepth //返回显示屏幕的颜色分辨率(比特每像素)
updateInterval //设置或返回屏幕的刷新率
width //返回显示器屏幕的宽度


History 对象
包含用户(在浏览器窗口中)访问过的URL。

属性
length //返回浏览器历史列表中的url数量

方法
back() //加载history列表中的前一个URL
forward() //加载history列表中的下一个URL
go() //加载历史列表中的某个具体的页面


Location对象
包含有关当前URL的信息。

属性
hash //设置或返回从井号(#)开始的URL(锚)
host //设置或返回主机名和当前URL的端口号
hostname //设置或返回当前URL的主机名
href //设置或返回完整的URL
pathname //设置或返回当前URL的路径部分
port //设置或返回当前URL的端口号
protocol //设置或返回当前URL的协议
search //设置或返回从问好(?)开始的URL(查询部分)

方法
assign() //加载新的文档
reload() //重新加载当前文档
replace() //用新的文档替换当前文档

原文地址:https://www.cnblogs.com/lionisnotkitty/p/6005113.html