BOM
Browser Object Model
知识点:
- navigator
- screen
- location
- history
可以通过history.back()和history.forward()来控制浏览器前进后退
题目二十三:如何检测浏览器的特性
检查是否为Chrome浏览器
var ua = navigator.userAgent
var isChrome = ua.indexOf('Chrome')
console.log(isChrome)
检查显示器屏幕大小
screen.width
screen.height
题目二十四:拆解url的各部分
这一题结合location来说明一下:
以下面这个网址为例
location.href // "http://coding.imooc.com/lesson/115.html#mid=5277"
location.protocol // "http:"
location.host // "coding.imooc.com"
location.pathname // "/lesson/115.html"
location.search // ""
location.hash // "#mid=5277"