怎样使用JavaScript在Web阅读器中猎取当前URL
发布时间:09/01 来源:未知 浏览:
关键词:
1、href:返回地址栏中显示的整个URL。
var currentURL = window.location.href;
2、host:返回地址栏中URL的主机名和端口。
var currentHost = window.location.host;
3、hostname:只返回地址栏中URL的主机名。
var currentHostname = window.location.hostname;
4、post:仅返回地址栏中URL的端口具体信息。
var currentPort = window.location.port;
5、protocol:返回地址栏中URL的和谈。就像URL使用HTTP(不使用SSL)或HTTPS(使用SSL)一样。
var currentProtocol = window.location.protocol;
6、pathname:返回地址栏中URL的途径名(域名后面的值)。
var currentPathname = window.location.pathname;
7、pathname:返回URL的锚点部分,包罗hash singh(#)。
var currenthash = window.location.hash;
8、search :返回URL的查询部分,例如以问号(?)开头的部分。
var currentSearchString = window.location.search;
本篇文章到这里就已经全部完毕了,更多出色内容大家可以关注百分百源码网的其他相关栏目教程!!!
以上就是怎样使用JavaScript在Web阅读器中猎取当前URL的具体内容,更多请关注百分百源码网其它相关文章!