Book Image

Practical Web Development

By : Paul Wellens
Book Image

Practical Web Development

By: Paul Wellens

Overview of this book

Table of Contents (23 chapters)
Practical Web Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
10
XML and JSON
Index

The History plugin


The popstate event and pushState method are part of the so-called History API that was introduced in HTML5. This means that our magic will only work if HTML5 capable browsers are used. That is, of course, not good enough. There are still a lot of people that visit your site using HTML4 capable browsers, so what do we do?

Fortunately, several plugins for jQuery exist that allow you to use the same, or a similar, API and have your code work in both types of browsers. One even has a name that will make you think of self-service restaurants again (BBQ), but I have been using the so-called jQuery history plugin. At the time of writing, the plugin could be found at https://github.com/browserstate/history.js.