2

I am building a search website, which will have results displayed using pagination. I am trying to figure out the best way to implement pagination of these results.

User searches for abcd in my website. I take him to the URL www.mydomain.com?search=abcd which has (say) 45 search results and I show him the first 10 and links to page2, page3, page4 and page5.

Approach 1: Once the user clicks on page2, I redirect him to www.mydomain.com?search=abcd&page=2 which displays the next 10 results.

Approach 2: Once the user clicks on page2, I do an AJAX call, get the next 10 results in JSON/XML format and reload just the results section instead of entire page. The browser URL won't change.

Approach 2 gives a good user experience because of just the section reload. But in Approach 2, if the user likes page2 results and saves/shares that browser URL, the URL will always lead him to page1. Also in approach 2, I have to build an additional RESTFUL service for the next page results.

*Which approach is better considering all factors? What is the standard way of pagination?*

1
  • 1
    For approach two, why not use a hash bang: www.mydomain.com?search=abcd#2 Commented Nov 5, 2013 at 21:59

3 Answers 3

0

Does method #2 really give a better experience? Just because "everyone is doing it and it looks cool" doesn't mean it is a good idea.

As a user, I cringe every time I run into pagination done via JavaScript because I know that it will break my back button.

  • Click on next page
  • While next page contents are loading, I spot something I was interested in
  • Click back button after the new contents have loaded
  • End up on page I was looking at before I started searching

Even worse is when I see an item I am interested in so I click on it to find out more about it. When I click on the back button to continue browsing, I'm presented with page 1 results.

There are ways to cope with this by modifying the history stack with JavaScript, but very few developers make use of it. Also, AJAX style content loading does nothing to help search engine crawlers find your content.

0
0

I would choose Approach 1 and focus on quality content. Google (search) has horrible URLs and complete page refreshes, but it's king because it delivers the best content.

You can't go wrong copying Google.

0
0

I think the right answer depends here, and it depends on what the use cases are. Do you see users ever wanting to copy or share a specific page of search results?

There's no point in adding an extra feature that nobody will use, so if you think the in-place load is a better experience, then you should only go with the new page option if you think the convenience of sharing pages is more important.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.