- 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.
- 編程的修煉
- Python數據分析基礎
- Python自動化運維快速入門(第2版)
- Android Application Development Cookbook(Second Edition)
- 新編Premiere Pro CC從入門到精通
- MySQL數據庫管理與開發實踐教程 (清華電腦學堂)
- 組態軟件技術與應用
- Apache Spark 2.x for Java Developers
- Principles of Strategic Data Science
- App Inventor少兒趣味編程動手做
- Python Web自動化測試設計與實現
- 從零開始學算法:基于Python
- MongoDB Administrator’s Guide
- Java編程指南:語法基礎、面向對象、函數式編程與項目實戰
- Web前端開發精品課:HTML5 Canvas開發詳解