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

Unsightly _pjax=true parameter in link URLs after pjaxing #89

Closed
henrik opened this issue Feb 5, 2012 · 1 comment
Closed

Unsightly _pjax=true parameter in link URLs after pjaxing #89

henrik opened this issue Feb 5, 2012 · 1 comment

Comments

@henrik
Copy link

henrik commented Feb 5, 2012

Figured out the solution myself, but putting it here for googleability if someone else has the same problem.

We saw the following behavior: if I'm on page /a and click a pjax link to page /b, everything is fine. But when I click a link from there on to page C, the link will say /c?_pjax=true and that's the URL I will see after following it.

The issue is simply that since pjax adds the _pjax=true parameter in its Ajax request for reasons of browser caching, the links in your view may render with that parameter included, depending on how you generate their URLs.

What I did in Ruby on Rails was simply a params[:_pjax] = nil in the controller (a before filter might be appropriate) before rendering the view. Doesn't interfere with the caching but helps the links render without that parameter.

@henrik henrik closed this as completed Feb 5, 2012
@romuloccomp
Copy link

pjax_request?

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

No branches or pull requests

2 participants