"Tell them what you're gonnna tell them."
We'll look at some of Infinite Scroll's UX problems.
We'll look at some possible solutions.
We'll talk about how this applies more broadly.
e·pit·o·me
/iˈpitəmē/
Noun
1. A person or thing that is a perfect example of a particular quality or type.
Example
Infinite Scroll is the epitome of bad UX.
Ok, fine, Infinite Scroll is not all bad.
Stickiness and engagement
One less click, hooray for laziness
AJAX content loading faster than full page load
Loading ahead of time, less waiting
UX: Anticipate the user's needs.
UX: Reduce unnecessary choices.
Infinite Scroll does these right... it is essentially deciding for you that you want to see the next page. And by eliminating that choice, users are much more likely to look at page 2 content.
There is one User Story that Infinite Scroll covers very well.
Just one.
I scroll down to read more, and hey whatdya know, it's already loaded!
But let me tell you another story...
now we know why people use inf scroll at all
going to look at a bunch of the problems
and then we're going to look at solutions
[scroll down a bajillion times] Hey, I'll click this interesting link!
Ok, now I'll just go back to where I left off...
...or yeah send me back to the beginning. Gee, thanks.
Facebook , Twitter , Pinterest
twitter / twitpic
pinterest / user link
typical solution is just to pop open new tabs, but sites are inconsistent, which is nuts. it's making me paranoid about clicking links. really messed up.
this is one of the two biggest issues with inf scroll
And then I leave the site.
Frustration is not engaging.
UX: Design for the platform.
(Don't break the back button.)
Great, my browser crashed...
Oops, I didn't mean to close that tab...
...back to the beginning, again? Sure, why not?
Twitter , Pinterest , Boing Boing
twitter, pinterest, boing boing personal story
mobile: have to reload each page to get back to where I was
there was this wonderful period of time where safari would just randomly decide to reload all tabs
You aren't loading... Why aren't you loading?
Ok, I'll try reloading... Page one? Hooray!
Twitter , Facebook , Pinterest , Brand New Pinterest
twitter used to give error message with no recovery option, now they give you a retry. this is good, but reload still takes you back to start.
facebook and pinterest just hang forever... new pinterest you can't even tell the difference between error and reaching the end
Wow, this stuff is amazing![scroll scroll coffee donut scroll] But never ends...
I should get to work.
UX: Design for busy people.
Also, remember new users and frequent users have different needs.
Theme: Resume
Supports resume: VHS, DVD, Netflix, ...
Twitter and Facebook are live feeds, but I've been able to pause live TV for a decade.
Why is there no way to resume reading later?
High Quality Theories:
Punish users who dare leave without reading everything.
Conspiracy to bore and frustrate workers on their internet breaks.
Why is there no way to resume reading later?
Higher Quality Theories:
Because there's no URL for where you left off!
Why is there no URL?
Because AJAX.
background loading content and appending it to the current page has all those benefits we discussed, but since we're ajax loading page 2 into page 1, we never actually visited page 2 and so our url never changed
How to Break My Browser 101:
Put your entire website experience on a single URL.
Browser URL Is Your App State
URL should represent current:
View
UI state
Content loaded in view
No URL for content?
No linking
No bookmarking
No back/forward button
No refreshing
No resuming
We can fix this!
Demo
live demo, quick go back through stories (back button, crashing, refresh cause not loading, bookmarking to read later) and show that the problems have gone away
What dark magick is this?
HTML5 History API
AJAX changes the current page's content.
History API changes the current page's URL.
Better Than #Hash
Change any/all of location except domain
No /puppies/#/monsters/frankenurls/
foo.com/contact/
→ foo.com/projects/
VS. foo.com/contact/
→ foo.com/contact/#/projects/
Real URL, server can populate directly on reload!
Can I use?
History API was added as part of HTML5 spec.
caniuse.com/#feat=history
IE 10+ (Why you always gotta be like this?)
GitHub: History.js polyfill *
* /hope/you/like/#/polyfills/
pink = unsupported browser
lack of IE support is a really, really poor reason not to fix this stuff for the other 50%+ of your users.
The API
Object: window.history
history.pushState(data, title, url )
history.replaceState(data, title, url )
Event: window.onpopstate
window.location.href
also reflects any changes.
Google: MDN History for more docs .
I think I get it!
So fixing Infinite Scroll is as easy as calling history.replaceState()
with the URL of the next page being AJAX loaded, right?
Ehhhhh, that's a start...
Demo
/**
* https://github.com/paulirish/infinite-scroll
* Infinite Scroll Load Success Callback
*/
function (elements, data, url) {
if (window.history) {
// Keep in mind user wants to refresh newest content on homepage.
// Push the state from the homepage, and replace after that so
// the user can press their back button once to return home.
if (window.location.href.match(homePattern)) {
history.pushState('', '', url);
} else {
history.replaceState('', '', url);
}
}
}
But what happens if the user scrolls back up?
Listen to scroll
events and replaceState
when we cross "page" boundaries.
Rare example of good infinite scroll!!
Uses replaceState
at post boundaries.
And another thing...
You cannot manipulate history without consequences!
(If a web page goes back in history and steps on a single butterfly...)
Back button returns you to your previous scroll position, but not your previous content.*
The user will return to just page 5, not pages 1 through 5.
And they'll be scrolled to the bottom of page 5.
* Sometimes Firefox and Safari remember** , but never Chrome.
** Never works for Twitter or GIS, does work for Pinterest. Redirect issue?
Uses URLs like /page1-5/
Back button restores whole range of pages.
Inefficient for large ranges.
Not ideal for bookmarking progress.
Bradbury Strikes Again
When we change the content, we can change the URL.
If the user presses Back/Forward, that will also change the URL... but it won't change the content.
Listen for popstate
event when the URL changes.
Make sure the correct content is displayed.
Infinite Scroll UX Problems Are History
(Puntastic!)
Demo
How else can we improve infinite scroll experiences?
I remember I saw that post...
...on page 7.
...last week.
...in February.
Why can't we do both?
Facebook demonstrates that we can have infinite scroll + "pagination" navigation.
Even better: integrate with the History API.
Pagination itself is a huge topic.
Don't have to paginate by page!
Reverse page numbering = real permalinks!
Prediction: "View Unread" / "View Unseen" will soon be hugely popular!
This presentation is about more than Infinite Scroll.
I <3 JavaScript.
JavaScript UI widgets and rich client-side JavaScript MVC applications are here to stay.
Remember:
We are making JavaScript web apps, viewed in a web browser .
What do web browsers got that native apps ain't got?
Back / Forward Buttons
Refresh Button
URL / Location Bar
Links / Bookmarks / Social APIs
Crash loses all state by default
Embrace the web.
Please don't break people's browsers.