【发布时间】:2014-03-07 10:32:37
【问题描述】:
使用此代码,它无法正确提供最后一个历史记录项,而是显示undefined:
<input type="button" onclick="getHistoryLast()" value="test">
<script>
function getHistoryLast(){
var x=history.previous;
alert(x);
}
</script>
检索最后一个历史项目的 URL 的正确代码是什么?
【问题讨论】:
-
嗯,
history.previous在 Gecko 中已过时,在 IE 中不受支持,也不是 W3C 规范的一部分。好像不能用。 -
我使用 onclick ="javascript:history.back()"
标签: javascript html history