循环“历史”在JavaScript中? [英] Loop over "history" in javascript?

查看:89
本文介绍了循环“历史”在JavaScript中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在javascript中循环历史对象以查找历史记录中的特定页面?

Is there a way to loop over the "history" object in javascript to find a specific page in the history?

推荐答案

安全原因 - 不,你不能转储浏览器的历史记录(使用javascript)

Security reasons - no, you can not dump the history of the browser (with javascript)

我的意思是你做不到

for(i=0;i<window.history.length; i++)
{
      alert(window.history[i]);
}

但是我没有很好的解释为什么历史.go(n); 没问题

However I don't have good explanation why history.go(n); is ok

这篇关于循环“历史”在JavaScript中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆