最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

JavaScript中的location、history、navigator對象實例介紹

 更新時間:2023年05月16日 00:22:16   作者:碼仙  
這篇文章主要介紹了JavaScript中的location、history、navigator對象實例介紹,需要的朋友可以參考下

1.location

//地址欄上#及后面的內(nèi)容
console.log(window.location.hash);
//主機名及端口號
console.log(window.location.host);
//主機名
console.log(window.location.hostname);
//文件的路徑---相對路徑
console.log(window.location.pathname);
//端口號
console.log(window.location.port);
//協(xié)議
console.log(window.location.protocol);
//搜索的內(nèi)容
console.log(window.location.search);
//設(shè)置跳轉(zhuǎn)的頁面的地址
location.href = "http://m.fzitv.net";//屬性----------------->必須記住
location.assign("http://m.fzitv.net");//方法
//重新加載--刷新
location.reload();
//沒有歷史記錄
location.replace("http://m.fzitv.net");

2.history

<body>
<input type="button" value="跳過去" id="btn1"/>
<input type="button" value="前進" id="btn2"/>
<script>
    //跳轉(zhuǎn)的
    document.getElementById("btn1").onclick = function () {
        window.location.;
    };
    //前進
    document.getElementById("btn2").onclick = function () {
        window.history.forward();
    };
</script>
</body>

歷史記錄的后退和前進 history: back()后退 forward()前進 

3.navigator

<script>
    //通過userAgent可以判斷用戶瀏覽器的類型
    console.log(window.navigator.userAgent);
    //通過platform可以判斷瀏覽器所在的系統(tǒng)平臺類型.
    console.log(window.navigator.platform);
</script>

到此這篇關(guān)于JavaScript中的location、history、navigator對象實例介紹的文章就介紹到這了,更多相關(guān)js location、history、navigator內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

赞皇县| 安福县| 宁陵县| 安徽省| 中江县| 汤原县| 米易县| 西贡区| 杨浦区| 台山市| 凤庆县| 同江市| 宁海县| 寿宁县| 浏阳市| 台北市| 武强县| 涞源县| 乌拉特后旗| 霍城县| 阜康市| 邳州市| 岱山县| 科技| 云梦县| 祁门县| 库伦旗| 鄂托克旗| 襄垣县| 普安县| 海城市| 绥江县| 黄浦区| 澎湖县| 石狮市| 冕宁县| 乌审旗| 淅川县| 忻城县| 嘉峪关市| 隆德县|