jQuery-pjax vs history.js to load specific content when clicked

前端 未结 1 1142
名媛妹妹
名媛妹妹 2021-02-02 01:25

I need to ajaxify my site, like loading a spinner or something for rendering specific content in a page when clicking a link.

I have found 2 good jQuery

相关标签:
1条回答
  • 2021-02-02 02:07

    author of History.js here.

    • History.js is extremely low-level and just focuses on providing a cross-browser compatible interface for the HTML5 History API
    • PJAX is high-level and utilises the HTML5 History API to provide a an interface for upgrading your website with AJAX using the two technologies.

    So you can get PJAX to use History.js so that it supports cross browsers. There is actually a request about this here.

    Though that doesn't mean History.js leaves you on your own either in regards to AJAX, it does provide you with a high-level sample for using History.js with AJAX here and you can find more info about how that was created here. Essentially that gist and PJAX do the same thing, but they have gone about them in different ways.

    In regards to simpler, History.js is the most low-level basic shortest simple thing you can get which will ensure the HTML5 History API works in all browsers - that's it's aim, to be as low-level and compact as possible so other things can extend it the way they want - such as PJAX or that Gist.

    0 讨论(0)
提交回复
热议问题