Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace current history entry #157

Open
obnijnil opened this issue May 9, 2018 · 4 comments
Open

Replace current history entry #157

obnijnil opened this issue May 9, 2018 · 4 comments

Comments

@obnijnil
Copy link

obnijnil commented May 9, 2018

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
Copy link
Collaborator

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
Copy link
Author

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

@BehindTheMath
Copy link
Collaborator

Is this possible with a regular link, without Pjax?

@obnijnil
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants