Browser history

Browser history

开发工具与关键技术:JS
作者:赵纯雨
班级:1803
撰写时间:2019.6.20

The browser history record, the previous one, for him, is for multiple web pages, but the history object records the pages (URL) that the user has visited, and can realize the navigation of the browser click forward and backward acquaintance type Note: Recording has been started from the moment the window has been opened. Every browser window, every label or even every frame has its own history object associated with a specific window object.
Syntax: window.history.[property|method], note: window can be omitted, and the function of window is to open internal web pages and external web pages. The window object is the core of the BOM browser object model, and the window object refers to the current The browser window, the following is the method and description of the window:
Insert picture description here
find the controller, then find the method, if there are parameters, splicing the parameters: Insert picture description here
history object attribute: length is the URL that returns the browser history list, that is, you The webpage that needs to be visited was accidentally returned, but I don’t know which webpage or which webpage it is, don’t panic, the history has already started the moment you opened the window, and it’s already being recorded, so now , You can open the historical tour records to view, all your historical tour records are in it, it will give you a good type, such as one day ago, one week ago, one month ago, etc., so that you can continue to visit this page next time , Basically this means, the history object methods:
Back(): load the previous URL in the history list,
Forward(): load the next URL in the history list,
Go(): load a specific one in the history list page,
As mentioned above, back and forward and go are themselves visiting the page, and back visits the previous web page, that is, the page that has been visited, click on the previous step to return to the current previous page, and forward it Visiting is the next page, the page you are about to visit, click on the page to go to the next page, and when you click, the browser history will record the web page you have or are visiting, and go to it It is a web page being visited, var HL = history.length; it represents the number of URLs in the history browser list:
Document.write (window.history.length);
return to the previous page; back() The code equivalent to go(-1) is as follows:
Window.history.go(1)
Window.history.go(), go when it is one time is the next, when it is two, it is the next two, forward It has the same meaning, they all represent the next one,
Function goback() {
Window. History. Back(); Next connection
}
A method of link properties:
Document.write(window.location.host); Return the host name and port number of the current URL
Document.write(window.location.href); Return the complete URL
Function go { Window. Location.href = "/home/chaptereighttime"; } Host port number, when it is not linking, then he is getting the web page,



Document.write (window.location.host+"
"); returns the host name and current URL port number, when it is on the left, it is set to set the page href to jump to other pages.
Since location has been used above, here are its properties and descriptions:
Insert picture description here
Protocol(): Set or return the protocol of the current URL
Search(): Set or return the URL starting from the question mark (query part)
Assign(): Load a new document
Reload(): Reload the current document
Replace(): Replace the current document with a new document

Guess you like

Origin blog.csdn.net/weixin_44540773/article/details/93889324