Building a Simple Mobile-optimized Web App Using the jQuery Mobile Framework

St. Petersburg College
St. Petersburg CollegeLibrarian/Educator
Building a Simple Mobile-optimized Web
App/Site Using the jQuery Mobile Framework
http://www.slideshare.net/chadmairn




                @cmairn
Agenda
• Learn what a mobile framework is.

• Understand the various technologies (HTML, CSS, JavaScript) and
  how they work together to build mobile Web apps/sites.

• Recognize the differences between native and web apps/sites.

• Explore jQuery Mobile basics.

• Acquire best practices in mobile Web development.

• Create an opportunity to continue to work with me after the
  webinar to demonstrate what you learned.

• Gain access after the webinar to a free Web server so you can see
  your mobile Web app/site live.
Virtual Petting Zoo


    Google Plus
     Hangout




   gplus.to/chadmairn
Quick Poll
Does your library have:

 Mobile-optimized Website

 Native App (iOS, Android etc.)

 Nothing yet, but considering an app

  Nothing yet, but considering a website.

  No plans; it is too expensive/complex!
Building a Simple Mobile-optimized Web App Using the jQuery Mobile Framework
Source: http://http://goo.gl/y8CFb
jQuery Mobile is …

a unified, HTML5-based user interface system
   for all popular mobile device platforms.




                                Source: http://jquerymobile.com/
jQuery Mobile is well-documented and
there are great demos to get you started
What is HTML, CSS, and JavaScript
and how do they all fit together?
HyperText Markup Language (HTML) is the skeleton.




Cascading Style Sheets (CSS) are the skin, clothes, cologne etc.




                 JavaScript is the personality. The character. The pizazz!

                                                         Source: http://goo.gl/kWzET
Native Apps vs. Web/Browser Apps
                  Issues                          Native apps                               Web apps

Internet access                    Not required                              Required, except for apps written in
                                                                             HTML5 (offline capabilities)


Shareable content (Twitter etc.)   Only if it is built in to the app         Web links can be shared. Social API’s
                                                                             allow 1-click posting


Access to hardware sensors         Yes: camera, gyroscope, microphone,       Access thru browser is limited.
                                   compass, accelerometer, GPS               Geolocation works!



Development                        Build app for target platform (Android,   Write/publish once using standard Web
                                   iOS [Objective-C] etc.)                   technologies, view it anywhere with
                                                                             URL. Speedy debugging and
                                                                             development.
Distribution                       Most app stores require approval.         No hassles.




                                                                                              Source: http://goo.gl/zSeDU
Getting Started!
Take an emulated look at your desktop site.
 Mobile Site               Desktop Site
Small Screen Rendering (260 px) using the
   Web Developer add-on in Firefox
Desktop                        Small Screen
In-page Analytics




Note: you can determine how your user’s
are accessing your Web site (e.g., mobile
devices, carriers, browsers , OS’s, screen
resolution etc.)
“Fundamentally, 'mobile'
refers to the user, not the
  device or application.”


Barbara Ballard Designing the Mobile User Experience
Mobile Screen Resolutions




  Android (Motorola Droid) 480x854
  Android (MyTouch) 320x480
  Android (Nexus One) 480x800
  Apple iPhone 320x480
  Apple iPad 1024x768
  Palm Pre 320 x 480
                                     Source: http://goo.gl/zEDoi
Learn and borrow from sites you like.




       http://m.novarelibrary.com/
Sketch ideas
Rapid Prototyping for jQuery Mobile




    Try it at http://codiqa.com/
Try it at http://jquerymobile.com/themeroller/
Quick jQuery Mobile Demo

  Highlight Documentation
      CDN-Hosted Files
     Viewport Meta Tag
  Creating a Basic Template
     Listview with Filter
Buttons with different themes
Advanced Example (Web SQL Database stores data within user’s
 browser. No cookies!) HTML5 has offline storage capabilities!




                                                            Favorites List
                                                            Favorites Found: 4

                                                            Conference
                                                            Committee, Friday, 8-
                                                            9am, Azalea A

                                                            Building the Next Generation
                                                            of E-Govt, Thurs. 1-
                                                            2pm, Jasmine

                                                            Opening General
                                                            Session, Wed. 9:15-
                                                            11:15am, Floral Ballroom




 http://novarelibrary.com/FLAmobile/   Note: this URL is not a best practice. More later.
http://www.w3.org/TR/webdatabase/



Although Web SQL Database worked on this Web app, the W3C recommends these
      storage-related specifications: Web Storage and Indexed Database API.
Steal, umm, borrow this code if you want.
<script type="text/javascript">
var db = openDatabase('mydb', '1.0', 'Test DB', 100000);
var msg;
var insertTxt = "";
$(document).ready(function() {
$("button").click(function(event) {
if(!confirm("Would you like to add to your favorites?")) {
             return;
}
insertTxt = $(this).text();
db.transaction(function (tx) {
             tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id INTEGER NOT NULL PRIMARY KEY
AUTOINCREMENT, log TEXT NOT NULL )',[],function(tx, result){},function(tx,error){alert("Error: Disable private
browsing");});

   tx.executeSql('SELECT * FROM LOGS WHERE log = ?',[insertTxt], function(tx, result) {
if(result.rows.length == 0) {
tx.executeSql('INSERT INTO LOGS (log) VALUES (?);', [insertTxt]);
}
});
});
});
});
</script>
Some Best Practices
• Follow the "m" convention (m.novarelibrary.com OR
  lifeonterra.com/m/)

• Keep categories (directories) short. Remember that you are creating a
  page that people touch without much typing

• Limit image and markup sizes

• Limit HTML pages to 25KB to allow for caching

• "Minify" your scripts and CSS (JSLint, CleanCSS)

• Link to Full Site

• Sniff for User Agent – Detection (allow the user to decide where to go)

• One Column Layout with some whitespace

• Mobile refers to the user!
Testing and validation

      Test Page Speed in Firebug




                     http://getfirebug.com/
W3C mobileOK Checker
http://validator.w3.org/mobile/
http://ready.mobi
Editors and Tools
• You can use a simple text editor (e.g., Notepad) or a more sophisticated application
  (e.g., Dreamweaver).

•   Adobe Device Central is part of Adobe’s CS.

• iUI: http://code.google.com/p/iui/ for iPhone.

• MIT Mobile Web Open Source Project
  http://sourceforge.net/projects/mitmobileweb/

• Device detection? http://detectmobilebrowsers.mobi/

• To see your browser's HTTP Headers. Works on mobile browsers.
  http://rabin.mobi/http

• Web Developer Toolbar in Firefox: Select Miscellaneous >>> Small Screen
  Rendering (260 px) >>> the layout will be reformatted to simulate rendering by a
  mobile browser.
Emulators/Simulators:
•   Cowemo Mobile Emulator: http://www.mobilephoneemulator.com/

•   dotMobi Emulator - http://mtld.mobi/emulator.php

•   Opera Mini Simulator - http://www.opera.com/mobile/demo/

•   Mimic - emulates European and Japanese models: N400i and N505i. http://pukupi.com/post/2059

•   Android Emulator - http://developer.android.com/guide/developing/tools/emulator.html

•   BlackBerry Device Simulators -
    https://www.blackberry.com/Downloads/entry.do?code=060AD92489947D410D897474079C1477

•   iPhone Dev Center: http://developer.apple.com/iphone/

•   Palm Pre - http://developer.palm.com/

•   Windows Mobile - http://msdn.microsoft.com/en-us/windowsmobile/default.aspx

•   JAVA ME - Java Platform Micro Edition was termed J2ME. It is considered one of the most ubiquitous
    application platform for mobile devices.
    http://java.sun.com/javame/reference/apis.jsp
Other mobile development tools/frameworks
The Future of Mobile Web App/Site Development? Responsive Web Design?
Free jQTouch Mobile Templates at:   http://goo.gl/biPJj




   Note: jQuery Mobile templates coming soon!
http://www.slideshare.net/chadmairn




                @cmairn
Virtual Petting Zoo


    Google Plus
     Hangout




   gplus.to/chadmairn
Want to
  Hangout?




gplus.to/chadmairn
1 of 38

More Related Content

Viewers also liked(20)

Impact of Open SourceImpact of Open Source
Impact of Open Source
Anne-Gaelle Colom3.8K views
Unit testingUnit testing
Unit testing
Leonardo Balter5.1K views
jQuery Conference 2012 keynotejQuery Conference 2012 keynote
jQuery Conference 2012 keynote
dmethvin20.4K views
CSS/SVG Matrix TransformsCSS/SVG Matrix Transforms
CSS/SVG Matrix Transforms
Marc Grabanski32.7K views
Introduction to Storm Introduction to Storm
Introduction to Storm
Chandler Huang20.1K views
DNS Security Presentation ISSADNS Security Presentation ISSA
DNS Security Presentation ISSA
Srikrupa Srivatsan9.9K views
Intro to Functional ProgrammingIntro to Functional Programming
Intro to Functional Programming
Hugo Firth4.9K views
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
DataStax Academy31.9K views
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Mike Dirolf38.4K views
Etsy Activity Feeds ArchitectureEtsy Activity Feeds Architecture
Etsy Activity Feeds Architecture
Dan McKinley112K views
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeper
Saurav Haloi128.4K views
Intro to HBaseIntro to HBase
Intro to HBase
alexbaranau42.6K views

Similar to Building a Simple Mobile-optimized Web App Using the jQuery Mobile Framework(20)

More from St. Petersburg College(20)

Introducing Immersive Technologies for Libraries  Introducing Immersive Technologies for Libraries
Introducing Immersive Technologies for Libraries
St. Petersburg College2.4K views
360° Tours and More360° Tours and More
360° Tours and More
St. Petersburg College333 views
Open Education Resources in LibrariesOpen Education Resources in Libraries
Open Education Resources in Libraries
St. Petersburg College972 views
Understanding Artificial IntelligenceUnderstanding Artificial Intelligence
Understanding Artificial Intelligence
St. Petersburg College311 views
Web Design Trends: 2018 EditionWeb Design Trends: 2018 Edition
Web Design Trends: 2018 Edition
St. Petersburg College2.9K views
What’s New With 3D Design and Printing?What’s New With 3D Design and Printing?
What’s New With 3D Design and Printing?
St. Petersburg College300 views
Creating a Program to Assist Users Cutting CableCreating a Program to Assist Users Cutting Cable
Creating a Program to Assist Users Cutting Cable
St. Petersburg College574 views
Understanding Artificial Intelligence Understanding Artificial Intelligence
Understanding Artificial Intelligence
St. Petersburg College709 views
Beginning Python ProgrammingBeginning Python Programming
Beginning Python Programming
St. Petersburg College2.1K views
3D Design Fundamentals3D Design Fundamentals
3D Design Fundamentals
St. Petersburg College2.9K views
STEM DemystifiedSTEM Demystified
STEM Demystified
St. Petersburg College710 views
Open Education Resources in LibrariesOpen Education Resources in Libraries
Open Education Resources in Libraries
St. Petersburg College686 views
Learning Kodu: Basic Video Game Design for KidsLearning Kodu: Basic Video Game Design for Kids
Learning Kodu: Basic Video Game Design for Kids
St. Petersburg College1.8K views
Learn to Code and Have Fun Doing It! Learn to Code and Have Fun Doing It!
Learn to Code and Have Fun Doing It!
St. Petersburg College2.9K views

Recently uploaded(20)

The Research Portal of Catalonia: Growing more (information) & more (services)The Research Portal of Catalonia: Growing more (information) & more (services)
The Research Portal of Catalonia: Growing more (information) & more (services)
CSUC - Consorci de Serveis Universitaris de Catalunya59 views
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
Eleanor McHugh36 views
Java Platform Approach 1.0 - Picnic MeetupJava Platform Approach 1.0 - Picnic Meetup
Java Platform Approach 1.0 - Picnic Meetup
Rick Ossendrijver24 views

Building a Simple Mobile-optimized Web App Using the jQuery Mobile Framework

  • 1. Building a Simple Mobile-optimized Web App/Site Using the jQuery Mobile Framework
  • 3. Agenda • Learn what a mobile framework is. • Understand the various technologies (HTML, CSS, JavaScript) and how they work together to build mobile Web apps/sites. • Recognize the differences between native and web apps/sites. • Explore jQuery Mobile basics. • Acquire best practices in mobile Web development. • Create an opportunity to continue to work with me after the webinar to demonstrate what you learned. • Gain access after the webinar to a free Web server so you can see your mobile Web app/site live.
  • 4. Virtual Petting Zoo Google Plus Hangout gplus.to/chadmairn
  • 5. Quick Poll Does your library have: Mobile-optimized Website Native App (iOS, Android etc.) Nothing yet, but considering an app Nothing yet, but considering a website. No plans; it is too expensive/complex!
  • 8. jQuery Mobile is … a unified, HTML5-based user interface system for all popular mobile device platforms. Source: http://jquerymobile.com/
  • 9. jQuery Mobile is well-documented and there are great demos to get you started
  • 10. What is HTML, CSS, and JavaScript and how do they all fit together?
  • 11. HyperText Markup Language (HTML) is the skeleton. Cascading Style Sheets (CSS) are the skin, clothes, cologne etc. JavaScript is the personality. The character. The pizazz! Source: http://goo.gl/kWzET
  • 12. Native Apps vs. Web/Browser Apps Issues Native apps Web apps Internet access Not required Required, except for apps written in HTML5 (offline capabilities) Shareable content (Twitter etc.) Only if it is built in to the app Web links can be shared. Social API’s allow 1-click posting Access to hardware sensors Yes: camera, gyroscope, microphone, Access thru browser is limited. compass, accelerometer, GPS Geolocation works! Development Build app for target platform (Android, Write/publish once using standard Web iOS [Objective-C] etc.) technologies, view it anywhere with URL. Speedy debugging and development. Distribution Most app stores require approval. No hassles. Source: http://goo.gl/zSeDU
  • 14. Take an emulated look at your desktop site. Mobile Site Desktop Site
  • 15. Small Screen Rendering (260 px) using the Web Developer add-on in Firefox Desktop Small Screen
  • 16. In-page Analytics Note: you can determine how your user’s are accessing your Web site (e.g., mobile devices, carriers, browsers , OS’s, screen resolution etc.)
  • 17. “Fundamentally, 'mobile' refers to the user, not the device or application.” Barbara Ballard Designing the Mobile User Experience
  • 18. Mobile Screen Resolutions Android (Motorola Droid) 480x854 Android (MyTouch) 320x480 Android (Nexus One) 480x800 Apple iPhone 320x480 Apple iPad 1024x768 Palm Pre 320 x 480 Source: http://goo.gl/zEDoi
  • 19. Learn and borrow from sites you like. http://m.novarelibrary.com/
  • 21. Rapid Prototyping for jQuery Mobile Try it at http://codiqa.com/
  • 22. Try it at http://jquerymobile.com/themeroller/
  • 23. Quick jQuery Mobile Demo Highlight Documentation CDN-Hosted Files Viewport Meta Tag Creating a Basic Template Listview with Filter Buttons with different themes
  • 24. Advanced Example (Web SQL Database stores data within user’s browser. No cookies!) HTML5 has offline storage capabilities! Favorites List Favorites Found: 4 Conference Committee, Friday, 8- 9am, Azalea A Building the Next Generation of E-Govt, Thurs. 1- 2pm, Jasmine Opening General Session, Wed. 9:15- 11:15am, Floral Ballroom http://novarelibrary.com/FLAmobile/ Note: this URL is not a best practice. More later.
  • 25. http://www.w3.org/TR/webdatabase/ Although Web SQL Database worked on this Web app, the W3C recommends these storage-related specifications: Web Storage and Indexed Database API.
  • 26. Steal, umm, borrow this code if you want. <script type="text/javascript"> var db = openDatabase('mydb', '1.0', 'Test DB', 100000); var msg; var insertTxt = ""; $(document).ready(function() { $("button").click(function(event) { if(!confirm("Would you like to add to your favorites?")) { return; } insertTxt = $(this).text(); db.transaction(function (tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, log TEXT NOT NULL )',[],function(tx, result){},function(tx,error){alert("Error: Disable private browsing");}); tx.executeSql('SELECT * FROM LOGS WHERE log = ?',[insertTxt], function(tx, result) { if(result.rows.length == 0) { tx.executeSql('INSERT INTO LOGS (log) VALUES (?);', [insertTxt]); } }); }); }); }); </script>
  • 27. Some Best Practices • Follow the "m" convention (m.novarelibrary.com OR lifeonterra.com/m/) • Keep categories (directories) short. Remember that you are creating a page that people touch without much typing • Limit image and markup sizes • Limit HTML pages to 25KB to allow for caching • "Minify" your scripts and CSS (JSLint, CleanCSS) • Link to Full Site • Sniff for User Agent – Detection (allow the user to decide where to go) • One Column Layout with some whitespace • Mobile refers to the user!
  • 28. Testing and validation Test Page Speed in Firebug http://getfirebug.com/
  • 31. Editors and Tools • You can use a simple text editor (e.g., Notepad) or a more sophisticated application (e.g., Dreamweaver). • Adobe Device Central is part of Adobe’s CS. • iUI: http://code.google.com/p/iui/ for iPhone. • MIT Mobile Web Open Source Project http://sourceforge.net/projects/mitmobileweb/ • Device detection? http://detectmobilebrowsers.mobi/ • To see your browser's HTTP Headers. Works on mobile browsers. http://rabin.mobi/http • Web Developer Toolbar in Firefox: Select Miscellaneous >>> Small Screen Rendering (260 px) >>> the layout will be reformatted to simulate rendering by a mobile browser.
  • 32. Emulators/Simulators: • Cowemo Mobile Emulator: http://www.mobilephoneemulator.com/ • dotMobi Emulator - http://mtld.mobi/emulator.php • Opera Mini Simulator - http://www.opera.com/mobile/demo/ • Mimic - emulates European and Japanese models: N400i and N505i. http://pukupi.com/post/2059 • Android Emulator - http://developer.android.com/guide/developing/tools/emulator.html • BlackBerry Device Simulators - https://www.blackberry.com/Downloads/entry.do?code=060AD92489947D410D897474079C1477 • iPhone Dev Center: http://developer.apple.com/iphone/ • Palm Pre - http://developer.palm.com/ • Windows Mobile - http://msdn.microsoft.com/en-us/windowsmobile/default.aspx • JAVA ME - Java Platform Micro Edition was termed J2ME. It is considered one of the most ubiquitous application platform for mobile devices. http://java.sun.com/javame/reference/apis.jsp
  • 33. Other mobile development tools/frameworks
  • 34. The Future of Mobile Web App/Site Development? Responsive Web Design?
  • 35. Free jQTouch Mobile Templates at: http://goo.gl/biPJj Note: jQuery Mobile templates coming soon!
  • 37. Virtual Petting Zoo Google Plus Hangout gplus.to/chadmairn
  • 38. Want to Hangout? gplus.to/chadmairn