Почему window.history.go () не работает от некоторых страниц?

(редактирование: измененный большая часть вопроса)

Я получил свой ответ относительно того, Как перейти к самой первой странице вкладки.

В основном bookmarklet

  javascript:window.history.go(-(window.history.length - 1))

Это работает хорошо от всех страниц, но от некоторых страниц, особенно те, которые были неактивны в течение долгого времени, это не делает.

Существует ли лучший способ использовать это bookmarklet?

0
задан 20.03.2017, 12:17

1 ответ

Я попытался бы добавить некоторую форму проверки на значении, Вы являетесь передающими. Также: Вы говорите, что это не работает, но Вы не говорите, как это не работает (например, "это обновляет текущую страницу"; или "это возвращается к 1-й странице плюс 1"),

Запертый от w3:

The go(delta) method causes the UA to run the following steps:

   1. If the argument to the method was omitted or has the value zero, then act as if the location.reload() method was called instead, and abort these steps.
   2. Let delta be the argument to the method.
   3. If the index of the current entry of the joint session history plus delta is less than zero or greater than or equal to the number of items in the joint session history, then the user agent must do nothing.
   4. Let specified entry be the entry in the joint session history whose index is the sum of delta and the index of the current entry of the joint session history.
   5. Let specified browsing context be the browsing context of the specified entry.
   6. Traverse the history of the specified browsing context to the specified entry.
0
ответ дан 27.11.2019, 18:45

Теги

Похожие вопросы