Replace current history entry #157

Closed
opened 2018-05-09 08:02:31 -05:00 by obnijnil · 4 comments
obnijnil commented 2018-05-09 08:02:31 -05:00 (Migrated from github.com)

Is there an option, like data-pjax-action="replace", for replacing current history entry when requesting a new page by clicking a link or calling loadUrl(href, [options])?

eg. Given a history stack, page-a > page-b, it would be page-a > page-c after requesting page-c.

And it seems like a common usage.

Is there an option, like `data-pjax-action="replace"`, for replacing current history entry when requesting a new page by clicking a link or calling `loadUrl(href, [options])`? eg. Given a history stack, `page-a > page-b`, it would be `page-a > page-c` after requesting `page-c`. And it seems like a common usage.
BehindTheMath commented 2018-05-27 18:12:41 -05:00 (Migrated from github.com)

Pjax tries to copy the default behavior of browsers, which is to just add to the history stack when navigating to a new page.

I suppose this would be possible to implement, but how would you signify whether you wanted to replaceState() or pushState() when clicking a link?

Pjax tries to copy the default behavior of browsers, which is to just add to the history stack when navigating to a new page. I suppose this would be possible to implement, but how would you signify whether you wanted to replaceState() or pushState() when clicking a link?
obnijnil commented 2018-05-30 11:00:13 -05:00 (Migrated from github.com)

Setting an data attribute on a link, eg. data-pjax-action="replace", goes with replaceState().
Otherwise, it goes with the default action pushState().

Setting an data attribute on a link, eg. `data-pjax-action="replace"`, goes with `replaceState()`. Otherwise, it goes with the default action `pushState()`.
BehindTheMath commented 2018-09-26 09:57:02 -05:00 (Migrated from github.com)

Is this possible with a regular link, without Pjax?

Is this possible with a regular link, without Pjax?
obnijnil commented 2018-09-30 08:14:49 -05:00 (Migrated from github.com)

No. But it may be an enhancement fo common usages.

No. But it may be an enhancement fo common usages.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: iLoveElysia/pjax#157