跳转到主内容

Class: NavigationHistory

Class: NavigationHistory

Manage a list of navigation entries, representing the user's browsing history within the application.

Process: Main
This class is not exported from the 'electron' module. It is only available as a return value of other methods in the Electron API.

Each navigation entry corresponds to a specific page. The indexing system follows a sequential order, where the first available navigation entry is at index 0, representing the earliest visited page, and the latest navigation entry is at index N, representing the most recent page. Maintaining this ordered list of navigation entries enables seamless navigation both backward and forward through the user's browsing history.

实例方法

Returns boolean - Whether the browser can go back to previous web page.

Returns boolean - Whether the browser can go forward to next web page.

  • offset Integer

Returns boolean - Whether the web page can go to the specified offset from the current entry.

清除浏览器导航历史记录

Returns Integer - The index of the current page, from which we would go back/forward or reload.

  • index Integer

Returns Object:

  • url string - The URL of the navigation entry at the given index.
  • title string - The page title of the navigation entry at the given index.

If index is out of bounds (greater than history length or less than 0), null will be returned.

使浏览器回退到上一个页面。

使浏览器前进到下一个页面。

  • index Integer

将浏览器导航到指定的绝对页面索引。

  • offset Integer

Navigates to the specified offset from the current entry.

Returns Integer - History length.