检测浏览器(BOM)以及地址栏网址的API

navigator.userAgent  //检测浏览器的版本以及那个厂商的
(不怎么准,你比如360经常跟别人干架,所以别人检测到360浏览器就提示浏览器危险,所以360就自己修改了)


//分解这个地址
http://www.imooc.com/course/list?c=linux#mad=100 

location.protocol "http:" //打印结果

location.host "www.imooc.com" //打印结果 location.pathname "/course/list" //打印结果 location.search "?c=linux" //打印结果
 location.hash
"#mad=100" //打印结果

 

posted @ 2017-09-08 23:15  Model-Zachary  阅读(136)  评论(0编辑  收藏  举报