When on a view with an ajax pager, and after at least one ajax load, the links to the next pages will include a bunch of extra metadata related to ajax requests. Specifically ajax_page_state
and _wrapper_format
are included as query parameters. If you try to load this link, Drupal will return a bunch of JSON instead of rendering the page.
Steps to reproduce:
- Install latest Drupal 8.2.x
- Create 10 dummy articles
- Create a view of content with a page display at
/test-ajax-pager
- Add a full pager, limit to 2 items shown per page
- Under advanced, set
Use AJAX
toYes
- Go to
/test-ajax-pager
and click the link for page 2 - Copy the link for page 3, and open in a new browser window
Here's an example of what the link looks like /test-ajax-pager?ajax_page_state%5Btheme%5D=bartik&ajax_page_state%5Btheme_token%5D=&ajax_page_state%5Blibraries%5D=bartik%2Fglobal-styling%2Cclassy%2Fbase%2Cclassy%2Fmessages%2Ccontextual%2Fdrupal.contextual-links%2Ccontextual%2Fdrupal.contextual-toolbar%2Ccore%2Fdrupal.active-link%2Ccore%2Fhtml5shiv%2Ccore%2Fnormalize%2Cquickedit%2Fquickedit%2Cshortcut%2Fdrupal.shortcut%2Csystem%2Fbase%2Ctoolbar%2Ftoolbar%2Ctoolbar%2Ftoolbar.escapeAdmin%2Ctour%2Ftour%2Cuser%2Fdrupal.user.icons%2Cviews%2Fviews.ajax%2Cviews%2Fviews.module&_wrapper_format=drupal_ajax&page=2
and here's what it should look like /test-ajax-pager?page=2