موضوع History Window

موضوع History Window

History object contains the URLs visited by the user (in the browser window).

History object is a property of the window object.

History object can be accessed in the following ways:

window.history or history:

Example

let length = window.history.length;

Try it yourself

let length = history.length;

Try it yourself

Properties and methods of History object

Properties/Methods Description
back() Load the previous URL (page) from the history list.
و Load the next URL (page) from the history list.
و Load a specific URL (page) from the history list.
length Return the number of URLs (pages) in the history list.

Description of History object

History объект ابتدا برای نمایش تاریخچه مرورگرهای پنجره طراحی شده است. اما به دلیل دلایل حریم خصوصی، History对象 دیگر اجازه دسترسی به URLهای واقعی دیده شده توسط اسکریپت را نمی‌دهد. تنها عملکردی که همچنان استفاده می‌شود فقط back()،و forward() و go()

روش.

مثال

عملکرد زیر مانند کلیک بر روی دکمه بازگشت انجام می‌شود:

history.back()

عملکرد زیر مانند دو بار کلیک بر روی دکمه بازگشت انجام می‌شود: