Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
918 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

I mean you can not do

// This does not work
for (i=0; i<window.history.length; i++) {
      alert(window.history[i]);
}

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...