当前位置: 首页 > 工具软件 > pjax_rails > 使用案例 >

May we can use Turbolinks or Pjax in our web apps

巴帅
2023-12-01

Turbolinks[1]:

Turbolinks makes following links in your web application faster.
Instead of letting the browser recompile the JavaScript and CSS between each page change,
it keeps the current page instance alive and replaces only the body and the title in the head.

This is similar to pjax, but instead of worrying about what element on the page to replace,
and tailoring the server-side response to fit, we replace the entire body.
This means that you get the bulk of the speed benefits from pjax (no recompiling of the JavaScript or CSS)
without having to tailor the server-side response. It just works.

Pjax[2]:

pjax = pushState + ajax
pjax is a jQuery plugin that uses ajax and pushState to deliver a fast browsing experience with real permalinks,
page titles, and a working back button.

pjax works by grabbing html from your server via ajax and replacing the content of a container on your page with the ajax'd html.
It then updates the browser's current url using pushState without reloading your page's layout or any resources (js, css),
giving the appearance of a fast, full page load. But really it's just ajax and pushState.

[1] https://github.com/rails/turbolinks
[2] https://github.com/defunkt/jquery-pjax

转载于:https://www.cnblogs.com/LiuXianBlog/p/3850430.html

 类似资料:

相关阅读

相关文章

相关问答