Browser 对象

学习地址: http://www.runoob.com/jsref/obj-window.html

1. window 

 1.1 属性  (innerHeight, innerWidthlocalStoragesessionStorageouterHeightouterWidthscreen)

 1.2 方法 (alert(), open(), confirm(), close(), stop(), setTimeout(), setInterval())

2. location

 2.1 属性 (hash, hosthostnamehrefpathnameportprotocolsearch)

 2.2 方法 

  assign() 载入一个新的文档

  reload() 重新加载当前文档

  replace() 载入一个新文档来代替当前文档

3. history

 3.1 属性  length 返回历史列表中的网址数

    3.2 方法  

  back() 返回上一个url  = history.go(-1)

  forward()  加载历史列表中的下一个 URL = history.go(1)

  go() 加载某个具体页面

4. 对象存储 (sessionStorage , localStorage)

   4.1 sessionStorage 生命周期, 当前页面, 关掉当前窗口,sessionStorage 即被清空

   4.2 localStorage 生命周期, 整个浏览器, 关掉当前浏览器 , locationStorage 及清空

   4.3 属性  length 返回存储的数据条数

   4.4 方法  

  key(n)  返回存储对象中第 n 个键的名称

  getItem(keyname)  返回指定键的值

  setItem(keynamevalue)  添加键值

  removeItem(keyname) 移除键值

  clear() 清除对象中所有的键

5. Navigator  (不常用)

   5.1 属性 

  appCodeName 浏览器的代码名

  appName 浏览器名称‘

  appVersion 浏览器平台和版本信息

  cookieEnabled 浏览器是否启用cookie的布尔值

  platform 浏览器操作系统平台

  userAgent 返回由客户机发送服务器的user-agent 头部的值

   5.2 方法 (javaEnabled()taintEnabled()

6. Screen (浏览器屏幕信息)

   6.1 属性  (availHeight, availWidth, width, height, colorDepthpixelDepth)

  

  

   

   

原文地址:https://www.cnblogs.com/zxhome/p/9543967.html