WebApi

73 阅读1分钟

window.open("www.baidu.com/") 打开网页
window.close() 关闭网页

计时器

var timeId;
function start() {
    if (timeId) {
        return
    }
    timeId = setInterval(function () {
        console.clear()
        console.log(new Date().toLocaleString())
    }, 1000)
}
function stop() {
    clearInterval(timeId)
    timeId = null
}

Location.href获取当前页面的url

location.reload()刷新页面

History.back() 根据当前页面浏览记录后退一步 History.forward() 根据当前页面浏览记录前进一步