Pjax can work incorrectly when manually calling functions in History #249

Closed
opened 2022-08-09 09:42:35 -05:00 by EmptyDreams · 1 comment
EmptyDreams commented 2022-08-09 09:42:35 -05:00 (Migrated from github.com)

Suppose I have two pages:

  1. https://a
  2. https://b

Now I'm on the first page, and then I call history.replaceState to change the URL to https://c.

Then I click the link to jump to the second link, then use the browser's back button to go back to https://c, then use the forward button to go back to https://b, then click the back button again. At this point, you should jump back to the https://c page, but the actual situation is that the URL changes to https://c, but the page content is still https://b.

Suppose I have two pages: 1. `https://a` 2. `https://b` Now I'm on the first page, and then I call `history.replaceState` to change the URL to `https://c`. Then I click the link to jump to the second link, then use the browser's back button to go back to `https://c`, then use the forward button to go back to `https://b`, then click the back button again. At this point, you should jump back to the `https://c` page, but the actual situation is that the URL changes to `https://c`, but the page content is still `https://b`.
EmptyDreams commented 2022-08-12 08:51:17 -05:00 (Migrated from github.com)

The reason for 404 should be that the state I passed in manually overrides the state set by PJAX.

But I do need a way to tag a page, and now I have to identify it by adding parameters to the URL.

It is hoped that PJAX will not overwrite the original state in the state when the page jumps.

The reason for 404 should be that the `state` I passed in manually overrides the state set by PJAX. But I do need a way to tag a page, and now I have to identify it by adding parameters to the URL. It is hoped that PJAX will not overwrite the original `state` in the state when the page jumps.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: iLoveElysia/pjax#249