The common properties of the window object

Open (url, name, spec) url: This option can be used to create a prompt(url, name, spec) url: This option can be used to create a prompt(url, name, spec) Name: window opening method (_blank, _self, _parent, _top) _blank: open a new window _self: present window _parent: present window _top: present window in the parent window

Two, timer

1. Intermittent Timers
window.onload = function(){
    let num = 10
    let oSpan = document.getElementById('day')
    let timer = setInterval(function(){
        oSpan.innerHTML = --num
        if (num == 0) {
            clearInterval(timer)
        }
    }, 1000)
}

2, delay timer

let oSpan = document.getElementsByTagName('span')[0]
let timer = null
let num = 10

function count(){
    oSpan.innerHTML = --num
    timer = setTimeout(count, 1000)
    if (num == 0) {
        clearTimeout(timer)
    }
}

timer = setTimeout(count, 1000)

Navigator. UserAgent determines the type of browser navigator. CookieEnabled determines whether cookies are enabled in the browser

4. Location object

2, Reload current document window.location.reload() 3, Replace current document window.location.replace() with new document window.location.replace()

The History object

1, the back () : a url before loading history list 2, forward () : a url under the loading history list 3, go (number) : 4, pushState(state,title,url): 5, ReplaceState (State, Title, URL): Replace the current history with the specified URL, and will update the URL in the address bar to the URL without refreshing the viewer