BOM操作
Browser Object Model
题目
如何检测浏览器的类型
拆解url的各部分
知识点
navigator
var ua = navigator.userAgent;
var isChrome = ua.indexOf('Chrome');
console.log(isChrome);
screen
console.log(screen.width);
console.log(screen.height);
location
console.log(location.href);
console.log(location.protocol); //'http:' 'https:'
console.log(location.pathname); //'learn.199'
console.log(location.search);
console.log(location.hash);
history
history.back();
history.forward();
Browser Object Model
题目
如何检测浏览器的类型
拆解url的各部分
知识点
navigator
var ua = navigator.userAgent;
var isChrome = ua.indexOf('Chrome');
console.log(isChrome);
screen
console.log(screen.width);
console.log(screen.height);
location
console.log(location.href);
console.log(location.protocol); //'http:' 'https:'
console.log(location.pathname); //'learn.199'
console.log(location.search);
console.log(location.hash);
history
history.back();
history.forward();