中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

JavaScript Window History


window.history 對(duì)象包含瀏覽器的歷史。


Window History

window.history對(duì)象在編寫時(shí)可不使用 window 這個(gè)前綴。

為了保護(hù)用戶隱私,對(duì) JavaScript 訪問該對(duì)象的方法做出了限制。

一些方法:

  • history.back() - 與在瀏覽器點(diǎn)擊后退按鈕相同
  • history.forward() - 與在瀏覽器中點(diǎn)擊向前按鈕相同

Window history.back()

history.back() 方法加載歷史列表中的前一個(gè) URL。

這與在瀏覽器中點(diǎn)擊后退按鈕是相同的:

實(shí)例

在頁面上創(chuàng)建后退按鈕:

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <head> <script> function goBack() { window.history.back() } </script> </head> <body> <input type="button" value="Back" onclick="goBack()"> </body> </html>

以上代碼輸出為:


Window history.forward()

history forward() 方法加載歷史列表中的下一個(gè) URL。

這與在瀏覽器中點(diǎn)擊前進(jìn)按鈕是相同的:

實(shí)例

在頁面上創(chuàng)建一個(gè)向前的按鈕:

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script> function goForward() { window.history.forward() } </script> </head> <body> <input type="button" value="Forward" onclick="goForward()"> </body> </html>

以上代碼輸出為: