Upgrade to Pro — share decks privately, control downloads, hide ads and more …

pjax & jianshu.pdf

57f0f3c86c0798a0d8486ed962f1924c?s=47 larryzhao
October 23, 2012

pjax & jianshu.pdf



October 23, 2012

More Decks by larryzhao

Other Decks in Technology


  1. Pjax & jianshu.io Larry Zhao Tuesday, October 23, 12

  2. What is pjax pjax = html5 push-state + Ajax pjax

    library to make life better: https://github.com/defunkt/jquery-pjax since Feb.26 2011 https://github.com/welefen/pjax since Jul.21 2011 Tuesday, October 23, 12
  3. Why pjax? Our web in old times We can.. ✓

    request and response, waiting for the next page to show. We can’t... ✘ update the page partialy ✘ operate on the page meanwhile it communicates with the server. Tuesday, October 23, 12
  4. Why pjax? ajax is invented We can.. ✓ update only

    a part of the page We can’t... ✘ no browser history ( can’t go back and forward) ✘ cannot share what you see to others with the link ✘ search engine crawlers can’t trigger ajax, don’t know your content ✘ json serialization Tuesday, October 23, 12
  5. Why pjax? finally pjax We can... ✓ update partially on

    page with original HTML response, don’t need to support another data type. ✓ browser history preserved ( enabled by HTML5 pushState ✓ Search Engine friendly. ✓ no json serialization/deserialization and heavy DOM manipulation on the client. Tuesday, October 23, 12
  6. What do I feel? Easy to implement, and it works

    quite good as DHH proposed. And you could write more ruby less javascript. It’s a little bit annoy dealing with the initialization code, because you need to call them again at pjax:success Tuesday, October 23, 12
  7. References http://37signals.com/svn/posts/3112-how-basecamp- next-got-to-be-so-damn-fast-without-using-much-client- side-ui https://twitter.com/dhh/status/239435882044727296 https://github.com/rails/turbolinks Tuesday, October 23, 12

  8. ۋ྆ ໡ૌ֥൮༜છ્ܲѢ฿࿒ֹઊุ݋౰Ӵၩဤ౨նࡅ٠໙ࡥ඀ KJBOTIVJP Tuesday, October 23, 12