易忘小知识点

最近学习了一下fiddler,在学习的过程中遇到一些平时经常遇到,但是又很模糊的地方。

console.info("href",window.loacation.href);
// href   http://localhost:5000/app/#/product/list?_k=vnoa99

//protocol 是协议
console.info("protocol",window.location.protocol);
//protocol http:


//hostname是主机名也叫ip地址
console.info("hostname",window.location.hostname);  
// hostname   localhost


//port是端口号
console.info("port",window.location.port);
// port 5000


//host是主机名和端口号
console.info("host",window.location.host);
// host   localhost:5000 


//origin是协议,主机名和端口号
console.info("origin",window.location.origin);  
// origin   http://localhost:5000

//pathname是路径名
console.info("pathname",window.location.pathname);  
// pathname  /app/

 

 上面几个经常会搞混。

//url是https://i.cnblogs.com/EditPosts.aspx?opt=1
//search是经常用到的,代表?后面的所有字符串
console.info("search",window.location.search);
//search ?opt=1


console.info("hostname",window.location.hostname);
//hostname   i.cnblogs.com   这个是不加EditPosts.aspx的


//代表路径部分
console.info("pathname",window.location.pathname);
//pathname /EditPosts.aspx

 

 

posted on 2016-09-20 12:01  bless-19946  阅读(185)  评论(1编辑  收藏  举报

导航