本文主要为大家详细介绍了javascript如何获取到导航条中http信息,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能帮助到大家。
1、style中带有注释的部分为获取HTTP中的信息
2、body中显示效果为:
1)、打开页面是自动弹出输入提示框
2)、点击删除时,会有警告框弹出
点击确定时,删除信息
点击取消时,不删除信息
代码
nbsp;html> <meta> <meta> <title></title> <!-- JavaScript代码 --> <script> // console.log("URL地址: " + window.location.href); // console.log("主机名: " + window.location.hostname); // console.log("端口: " + window.location.port); // console.log("主机: " + location.host); // 主机名+端口 // console.log("协议: " + location.protocol); // console.log("路径: " + location.pathname); // console.log("有效的宽度(单位:像素): " + screen.availWidth); // console.log("有效的高度(单位:像素): " + screen.availHeight); // console.log("每个像素颜色的位数: " + screen.colorDepth); // document.write("官方浏览器代码名的字符串的表示:" + navigator.appCodeName + "<br/>"); // document.write("官方浏览器名的字符串的表示:" + navigator.appName + "<br/>"); // document.write("用户代理:" + window.navigator.userAgent + "<br/>"); // document.write("版本信息:" + window.navigator.appVersion + "<br/>"); // document.write("浏览器所在的计算机的平台:" + window.navigator.platform + "<br/>"); // document.write("Cookie:" + window.navigator.cookieEnabled + "<br/>"); </script><script> function remove() { var r = confirm("确定要删除吗?"); console.log(r); } prompt("您几岁?"); </script>
姓名 | 年龄 | 操作 |
---|---|---|
张三 | 19 | |
李四 | 18 | |
王五 | 20 | |
赵六 | 21 | |
孙七 | 20 |
以上就是JavaScript获取导航条中HTTP信息实例分享的详细内容,更多请关注php中文网其它相关文章!
Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号