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

"Fix" relative links in Ajax responses #6258

Closed
mrclay opened this issue Dec 5, 2013 · 4 comments
Closed

"Fix" relative links in Ajax responses #6258

mrclay opened this issue Dec 5, 2013 · 4 comments
Labels

Comments

@mrclay
Copy link
Member

mrclay commented Dec 5, 2013

I'm grabbing entity/river listings via Ajax views, and this works well except I have to rewrite any relative links (notably pagination links) in the response because they're relative to the Ajax request, not the user's location.href.

Strawman solution: If XHR and an HTTP Referrer is available, use referrer for base of pagination rewrites.

@Srokap
Copy link
Contributor

Srokap commented Dec 5, 2013

I think I was fixing this issue by using base_url parameter and condition that you describe. I think we could just change the default behavior with this ticket, but still allow to override base url.

Everything on the PHP side (contrary to what label suggests)

@mrclay
Copy link
Member Author

mrclay commented Dec 5, 2013

I see:

if (elgg_is_xhr()) {
    $options['base_url'] = $_SERVER['HTTP_REFERER'];
}

I guess the question is whether core pagination should just do this automatically (if base_url isn't already set).

I removed the "Javascript" label.

@Srokap
Copy link
Contributor

Srokap commented Dec 5, 2013

I have no problem with doing such change to default behavior and I think it's dev-friendly after all.

@mrclay
Copy link
Member Author

mrclay commented Dec 6, 2013

PR #6263

@mrclay mrclay closed this as completed in f1217e4 Dec 6, 2013
Srokap added a commit that referenced this issue Dec 6, 2013
Fixes #6258: Pagination uses HTTP referrer as default base_url for Ajax requests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants