zoukankan      html  css  js  c++  java
  • 前端常用的一些浏览器对象

    有哪些常用的 Bom 属性呢?
    
    (1)location 对象
    
    location.href-- 返回或设置当前文档的 URL
    
    location.search -- 返回 URL 中的查询字符串部分。例 如 http://www.dreamdu.com/dreamdu.php?id=5&name=dreamdu 返回包括(?)后面的内 容?id=5&name=dreamdu location.hash -- 返回 URL#后面的内容,如果没有#,返回空
    
    location.host -- 返回 URL 中的域名部分,例如 www.dreamdu.com
    
    location.hostname -- 返回 URL 中的主域名部分,例如 dreamdu.com
    
    location.pathname -- 返回 URL 的域名后的部分。例如 http://www.dreamdu.com/xhtml/ 返 回/xhtml/
    
    location.port -- 返回 URL 中的端口部分。例如 http://www.dreamdu.com:8080/xhtml/ 返回 8080
    
    location.protocol -- 返回 URL 中的协议部分。例如 http://www.dreamdu.com:8080/xhtml/ 返 回(//)前面的内容 http:
    
    location.assign -- 设置当前文档的 URLlocation.replace() -- 设置当前文档的 URL,并且在 history 对象的地址列表中移除这个 URL
    
    location.replace(url); location.reload() -- 重载当前页面
    
    (2)history 对象
    
    history.go() -- 前进或后退指定的页面数 例如:history.go(num);
    
    history.back() -- 后退一页
    
    history.forward() -- 前进一页
    
    (3)Navigator 对象
    
    navigator.userAgent -- 返回用户代理头的字符串表示(就是包括浏览器版本信息等的字 符串)
    
    navigator.cookieEnabled -- 返回浏览器是否支持(启用)cookie
  • 相关阅读:
    692. Top K Frequent Words
    659. Split Array into Consecutive Subsequences
    hdu5015矩阵快速幂
    codefroces 450B矩阵快速幂
    ural Ambitious Experiment 树状数组
    poj3254 状态压缩dp
    poj2686 状压dp入门
    hdu4763 kmp
    hdu4847 kmp
    hdu3294 manacher
  • 原文地址:https://www.cnblogs.com/ChineseLiao/p/14804817.html
Copyright © 2011-2022 走看看