O'Reilly logo

jQuery Mobile Web Development Essentials Second Edition by Andy Matthews, Raymond Camden

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

jQuery Mobile and URLs

If you've opened up test2.html in your browser and played with it, you may have noticed something interesting about the URLs as you navigate. Following is the initial URL (the address and folder will, of course, differ on your computer): http://localhost/mobile/c2/test2.html.

After clicking on products, the URL changes to http://localhost/mobile/c2/products.html. If I click on back, and click on learn more, I get http://localhost/mobile/c2/test2.html#aboutPage.

In both subpages (the Products page and the About page) the URL was changed by the framework itself. The framework uses history.pushState and history.replaceState in browsers that support it. For older browsers, or browsers that don't support JavaScript manipulation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required