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

Categories

0 votes
922 views
in Technique[技术] by (71.8m points)

jquery - Loop over "history" in javascript?

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

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

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...