- jQuery Mobile Web Development Essentials(Third Edition)
- Raymond Camden Andy Matthews
- 236字
- 2021-07-09 20:22:19
jQuery Mobile and URLs
If you've opened test2.html
in your browser and played with it, you may have noticed something interesting about the URLs as you navigate. The following is the initial http://localhost/mobile/c2/test2.html
URL (the address and folder will, of course, differ on your computer).
After clicking on Products, the URL will change to http://localhost/mobile/c2/products.html
. If I click on back and click on learn more, I will get http://localhost/mobile/c2/test2.html#aboutPage
.
In both the 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 the browsers that support it. For older browsers, or browsers that don't support JavaScript manipulation of the URL, hash-based navigation is used instead. The http://localhost/mobile/c2/test2.html#/mobile/c2/products.html
URL is an example of how this link would look.
What's interesting is that, in this bookmark style, test2.html
is always loaded first. You could actually build your products.html
file to only include p
and be assured that if the request was made for products first, it would still render correctly. It's the newer and fancier browsers that have an issue. If you didn't include the proper jQuery and jQuery Mobile includes, when they go directly to products.html
, you would end up with a page that has no styles. It's best to simply always include your proper header files (the CSS, the JavaScript, and so on). Any decent editor will provide simple ways to create templates.
- Visual C++程序設計教程
- Spring 5.0 Microservices(Second Edition)
- SoapUI Cookbook
- Learning ArcGIS Pro 2
- Vue.js入門與商城開發實戰
- Processing互動編程藝術
- SEO智慧
- 精通Linux(第2版)
- Go語言精進之路:從新手到高手的編程思想、方法和技巧(1)
- Android Wear Projects
- Geospatial Development By Example with Python
- 案例式C語言程序設計實驗指導
- 現代C:概念剖析和編程實踐
- 面向對象程序設計及C++(第3版)
- Three.js權威指南:在網頁上創建3D圖形和動畫的方法與實踐(原書第4版)