History.length

翻译不完整。 请帮助我们翻译这篇文章!

History.length是一个只读属性,返回当前session中的history个数,包含当前页面在内。举个例子,对于新开一个tab加载的页面当前属性返回值1。

 

语法

 

length = history.length;

例子

var result = window.history.length; // 返回当前session中的history个数

说明

说明 状态 注释
HTML Living Standard
History.length
Living Standard No change from HTML5.
HTML5
History.length
Recommendation Initial definition.

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
lengthChrome Full support YesEdge Full support 12Firefox Full support YesIE Full support 10Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support

参考

  • The History interface it belongs to.