Home  >  Article  >  Web Front-end  >  Html5 method to modify browser URL without refreshing_html5 tutorial skills

Html5 method to modify browser URL without refreshing_html5 tutorial skills

WBOY
WBOYOriginal
2016-05-16 15:48:341689browse

Ajax partial refresh can modify the browser address through the new features of HTML5.

window.history represents the history record of the window object

window.history.pushState(object, title, new_url) -- Add a new history record point in window.history

window.history.replaceState(object, title, new_url) -- Replace the history record point of the current page in window.history

object - You can expand the desired object

title - Currently All browsers do not support

new_url. The browser will not check whether the url exists. It only changes the url. The url must be in the same domain and cannot cross domains.

eg: original url: www.test.com

window.history.pushState({time: 'test'}, ' ', 'www.test_test.com')

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn