zoukankan      html  css  js  c++  java
  • window内置对象学习

    1.location:本页面的location对象

    对象属性图示:

    对象属性:

    对象方法:

    2.history:是本页面的浏览历史

    history对象记录了用户曾经浏览过的页面(URL),并可以实现浏览器前进与后退相似导航的功能。

    注意:从窗口被打开的那一刻开始记录,每个浏览器窗口、每个标签页乃至每个框架,都有自己的history对象与特定的window对象关联。

    属性:

    方法:

    其中window.history.go(1)表示的是后一个相当于window.history.forward();而window.history.go(-1)表示的相当于window,history.back();本次就是window.history.go(0).

    3.Navigator:

    Navigator 对象包含有关浏览器的信息,通常用于检测浏览器与操作系统的版本。

    属性:

    4.userAgent:

    返回用户代理头的字符串表示(就是包括浏览器版本信息等的字符串)

    属性:

    判断当前使用的是什么浏览器:

    function validB(){ 
      var u_agent = navigator.userAgent; 
      var B_name="Failed to identify the browser"; 
      if(u_agent.indexOf("Firefox")>-1){ 
          B_name="Firefox"; 
      }else if(u_agent.indexOf("Chrome")>-1){ 
          B_name="Chrome"; 
      }else if(u_agent.indexOf("MSIE")>-1&&u_agent.indexOf("Trident")>-1){ 
          B_name="IE(8-10)";  
      }
        document.write("B_name:"+B_name+"<br>");
        document.write("u_agent:"+u_agent+"<br>"); 
    } 
    View Code

    5.screen:

    screen对象用于获取用户的屏幕信息。

    属性;

  • 相关阅读:
    XCode 7 运行 cocos2dx 2.2.6问题小节
    SerializeField和Serializable
    convert2utf8withbom
    NGUI制作字体的三种方法
    js json stringify
    nodejs npm 使用淘宝 NPM 镜像
    js url?callback=xxx xxx的介绍
    强引用 弱引用
    关于xml里的encoding
    js 历史
  • 原文地址:https://www.cnblogs.com/fireporsche/p/6306424.html
Copyright © 2011-2022 走看看