SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Introduction to Mobile Web
     and Best Practices
        Bryan Hughes, Ph.D.
         Software Engineer
            Appcelerator

      bhughes@appcelerator.com

                                 1
About Me

           • Appcelerator Software Engineer in
             the JavaScript Engineering group

           • Previously developed the HTML 5
             platform at Particle Code

           • Ph.D. in Electrical Engineering and
             Computer Science from Texas
             Tech University




                                             2
Mobile Web
Platform Overview
Titanium Mobile Target

                  • Provides similar experience to
                    Android and iOS

                  • Not intended for integration into
                    existing web apps/frameworks

                  • Designed specifically for mobile
                    browsers and devices




                                                        4
Single Page Web App

                 • Apps are hosted on traditional web
                   servers

                 • Users use their device‟ browser to
                   navigate to the URL of the app

                 • Apps are a single page only




                                                   5
Architecture

               • Uses HTML 5 technologies to
                 implement the Titanium Mobile API

               • APIs implemented using
                 Asynchronous Module Definition

               • Everything is require()‟d


                  var ad = require('Ti/UI/AlertDialog'),
                    foo = new ad({
                        title: 'Mobile Web Rules!'
                    });
                  foo.show();



                                                           6
User Interface




• Controls are
  composites of
  other controls

• Custom layout    Ti.UI.View
  algorithm
                   Ti.UI.View
                   Ti.UI.ImageView
                   Ti.UI.Label

                                     7
File System



• Pluggable
  provider
  architecture

• Fully support
  directories,
  binary files, etc.




                       8
Miscellany


         Titanium API                   HTML/CSS API


 Ti.Network.HTTPClient   XML HTTP Request (XHR)


 Ti.Accelerometer        devicemotion window event

                         navigator.geolocation and deviceorientation
 Ti.Geolocation
                         window event

 Touch Gestures          touchstart/move/end window events


 Ti.Media.VideoPlayer    <video> HTML tag


                                                                       9
Mobile Web
Specific Features
Tiapp.xml Options
                <analytics>
                      <use-xhr>true, false</use-xhr>
                </analytics>
                <filesystem>
                      <backend>Ti/_/Filesystem/Local</backend>
                      <registry>preload</registry>
                </filesystem>
                <Instrumentation>true, false</Instrumentation>
                <precache>
                      <image>image path</image>
                      <include>file path</include>
                      <require>module id</require>
                      <locale>locale code</locale>
                </precache>
                <splash>
                      <enabled>true, false</enabled>
                      <inline-css-images>true, false</inline-css-
                </splash>
                <theme>theme name (default is „default‟)</theme>

                                                                    11
Splash Screen




  Created with
  HTML+CSS




                 12
Icons




• Favicon

• Apple Web
  Applications




                 13
Modules

          • CommonJS
            – Can only use Titanium APIs

            – Compatible with Android and iOS

          • MobileWeb
            – Can use any browser features

            – Will not work on Android and iOS




                                                 14
Hybrid Apps




  100% Written
   in Titanium




                 15
Debugging




 Debug like any
 other web page




                  16
Instrumentation




• Layout

• Networking

• System Load
  Time




                  17
Deploying

                            production minifies code

                   function myFunction(parameterOne, parameterTwo) {
• Web server         var parameterOnePlusFive = parameterOne + 5;
  agnostic           var parameterTwoPlusTen = parameterTwo + 10;
                   }
                   myFunction(5 + 10, 15 - 20);
• Deployment:
  development or
  production

                   function myFunction(a,b){var x=a+5,d=b+10}myFunction(15,-5)




                                                                            18
Limitations and
Common Pitfalls
Local Storage



• Several APIs use
  Local Storage

• 5mb Local
  Storage per
  domain

• Exception thrown
  when exceeded




                     20
Cross Domain HTTP


                    if (Ti.Platform.osname === 'mobileweb') {
                      Ti.Network.httpURLFormatter = function (url) {

• Access-Control-           // Create prefix from server’s hostname
                            var newPrefix =
  Allow-Origin                location.protocol + '//' + location.host +
  HTTP header                 (location.port ? ':' + location.port : '');

                            // Make sure URL isn't relative
• Proxy + URL               if (url.indexOf(newPrefix) === -1 &&
                                url.indexOf('://') !== -1) {
  formatter                   url = newPrefix + '/proxy?url=' + url;
                              console.debug('proxying to ' + url);
                            }
                            return url;
                        }
                    }




                                                                            21
WebViews



• Cross domain
  WebViews are
  limited

• Sites with X-
  Frame-Options
  set will not load




                      22
Code Limitations



• Variables and
  functions cannot
  use DOM names

• Titanium objects
  contain many
  “hidden” fields




                     23
Code Minification

                      function myFunction(parameterOne, parameterTwo) {
                        var parameterOnePlusFive = parameterOne + 5;
                        var parameterTwoPlusTen = parameterTwo + 10;
                      }
• Code minification   myFunction(5 + 10, 15 - 20);

  is not code
  obfuscation

• Code/resources      function myFunction(a,b){var x=a+5,d=b+10}myFunction(15,-5)

  cannot be
  secured in
  Mobile Web
                      function myFunction(a, b) {
                        var c = a + 5,
                          d = b + 10;
                      }
                      myFunction(15, -5);

                                                                               24
UI Performance

                 • Two layout passes per layout

                 • Browsers are slower than native

                 • Titanium apps that perform well in
                   Android/iOS may not perform well
                   in Mobile Web




                                                   25
Miscellany

             • Unsupported APIs
                – Database

                – Contacts

                – AudioPlayer

                – Sockets

             • Facebook Site URL must be set

             • Everything must be loaded over
               the network!

                                                26
Browser Compatibility

                  • Recommended
                     – Mobile Safari 4.2+
                     – Android 2.2+
                     – Chrome for Android
                     – Firefox Mobile for Android
                     – BlackBerry 7+, Playbook

                  • Limited Support
                     – Windows Phone 7.5 (Mango)
                     – BlackBerry 6 (Bold)
                                                    27
Optimizing for
Mobile Web
Security



• Everything in the
  app is public
  information

• Don‟t trust the
  client application

• Don‟t put private
  keys in code




                       29
Layout Optimizations

                  • Reduce the number of controls on
                    screen

                  • Only use vertical and horizontal
                    layouts if they are actually needed

                  • Use basic views whenever
                    possible

                  • Use gradients and solid colors
                    instead of images


                                                     30
Image Optimizations



• Compress            JPEG: 371 KB
  images with the
  correct CODEC       PNG: 2.3 MB

• Reduce image
  dimensions

• Reduce color        JPEG: 10.14 KB
  depth
                      PNG: 10.08 KB


                                       31
Pre-caching

              • Cache commonly used source
                code, images, and text files

              • Images are encoded as data URIs

              • Cached resources are inlined in
                index.html




                                                  32
Bryan Hughes, Ph.D.

bhughes@appcelerator.com

                           33

Weitere ähnliche Inhalte

Was ist angesagt?

Html5 features: location, history and offline apps
Html5 features: location, history and offline appsHtml5 features: location, history and offline apps
Html5 features: location, history and offline appsKonstantin Delchev
 
Architecture of the Web browser
Architecture of the Web browserArchitecture of the Web browser
Architecture of the Web browserSabin Buraga
 
Best Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentBest Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentShahar Evron
 
Create a welcoming development environment on IBM i
Create a welcoming development environment on IBM iCreate a welcoming development environment on IBM i
Create a welcoming development environment on IBM iAlan Seiden
 
Introduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformIntroduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformAlfresco Software
 
Optimizing HTML5 Sites with CQ5/WEM
Optimizing HTML5 Sites with CQ5/WEMOptimizing HTML5 Sites with CQ5/WEM
Optimizing HTML5 Sites with CQ5/WEMGabriel Walt
 
php[world] Magento101
php[world] Magento101php[world] Magento101
php[world] Magento101Mathew Beane
 
Introduction to eXo ECM Suite
Introduction to eXo ECM SuiteIntroduction to eXo ECM Suite
Introduction to eXo ECM SuiteTugdual Grall
 
Social Connections 12 - IBM Connections Adminblast
Social Connections 12 - IBM Connections AdminblastSocial Connections 12 - IBM Connections Adminblast
Social Connections 12 - IBM Connections AdminblastNico Meisenzahl
 
Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022NAVER D2
 
AD109 - Using the IBM Sametime Proxy SDK: WebSphere Portal, IBM Connections -...
AD109 - Using the IBM Sametime Proxy SDK: WebSphere Portal, IBM Connections -...AD109 - Using the IBM Sametime Proxy SDK: WebSphere Portal, IBM Connections -...
AD109 - Using the IBM Sametime Proxy SDK: WebSphere Portal, IBM Connections -...Carl Tyler
 
IBM i: Fertile Ground for PHP Developers
IBM i: Fertile Ground for PHP DevelopersIBM i: Fertile Ground for PHP Developers
IBM i: Fertile Ground for PHP DevelopersAlan Seiden
 
From Zero to ZF: Your first zend framework project on ibm i
From Zero to ZF: Your first zend framework project on ibm iFrom Zero to ZF: Your first zend framework project on ibm i
From Zero to ZF: Your first zend framework project on ibm iAlan Seiden
 
Sencha touchonbb10 bootcamp
Sencha touchonbb10 bootcampSencha touchonbb10 bootcamp
Sencha touchonbb10 bootcampn_adam_stanley
 
Code Generation in Magento 2
Code Generation in Magento 2Code Generation in Magento 2
Code Generation in Magento 2Sergii Shymko
 
HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)robinzimmermann
 
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slides
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slidesKeep Your Code Organized! WordCamp Montreal 2013 Presentation slides
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slidesJer Clarke
 
Creating Web Templates for SharePoint 2010
Creating Web Templates for SharePoint 2010Creating Web Templates for SharePoint 2010
Creating Web Templates for SharePoint 2010Mark Collins
 
Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発
Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発
Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発Atsushi Matsuo
 

Was ist angesagt? (20)

Html5 features: location, history and offline apps
Html5 features: location, history and offline appsHtml5 features: location, history and offline apps
Html5 features: location, history and offline apps
 
Architecture of the Web browser
Architecture of the Web browserArchitecture of the Web browser
Architecture of the Web browser
 
Best Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentBest Practices in PHP Application Deployment
Best Practices in PHP Application Deployment
 
Create a welcoming development environment on IBM i
Create a welcoming development environment on IBM iCreate a welcoming development environment on IBM i
Create a welcoming development environment on IBM i
 
Introduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformIntroduction to Alfresco Surf Platform
Introduction to Alfresco Surf Platform
 
A Bit of REST
A Bit of RESTA Bit of REST
A Bit of REST
 
Optimizing HTML5 Sites with CQ5/WEM
Optimizing HTML5 Sites with CQ5/WEMOptimizing HTML5 Sites with CQ5/WEM
Optimizing HTML5 Sites with CQ5/WEM
 
php[world] Magento101
php[world] Magento101php[world] Magento101
php[world] Magento101
 
Introduction to eXo ECM Suite
Introduction to eXo ECM SuiteIntroduction to eXo ECM Suite
Introduction to eXo ECM Suite
 
Social Connections 12 - IBM Connections Adminblast
Social Connections 12 - IBM Connections AdminblastSocial Connections 12 - IBM Connections Adminblast
Social Connections 12 - IBM Connections Adminblast
 
Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022
 
AD109 - Using the IBM Sametime Proxy SDK: WebSphere Portal, IBM Connections -...
AD109 - Using the IBM Sametime Proxy SDK: WebSphere Portal, IBM Connections -...AD109 - Using the IBM Sametime Proxy SDK: WebSphere Portal, IBM Connections -...
AD109 - Using the IBM Sametime Proxy SDK: WebSphere Portal, IBM Connections -...
 
IBM i: Fertile Ground for PHP Developers
IBM i: Fertile Ground for PHP DevelopersIBM i: Fertile Ground for PHP Developers
IBM i: Fertile Ground for PHP Developers
 
From Zero to ZF: Your first zend framework project on ibm i
From Zero to ZF: Your first zend framework project on ibm iFrom Zero to ZF: Your first zend framework project on ibm i
From Zero to ZF: Your first zend framework project on ibm i
 
Sencha touchonbb10 bootcamp
Sencha touchonbb10 bootcampSencha touchonbb10 bootcamp
Sencha touchonbb10 bootcamp
 
Code Generation in Magento 2
Code Generation in Magento 2Code Generation in Magento 2
Code Generation in Magento 2
 
HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)
 
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slides
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slidesKeep Your Code Organized! WordCamp Montreal 2013 Presentation slides
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slides
 
Creating Web Templates for SharePoint 2010
Creating Web Templates for SharePoint 2010Creating Web Templates for SharePoint 2010
Creating Web Templates for SharePoint 2010
 
Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発
Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発
Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発
 

Ähnlich wie Codestrong 2012 breakout session introduction to mobile web and best practices

Griffon for the Enterprise
Griffon for the EnterpriseGriffon for the Enterprise
Griffon for the EnterpriseJames Williams
 
Mobile App Development
Mobile App DevelopmentMobile App Development
Mobile App DevelopmentChris Morrell
 
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...Igalia
 
Mobile Web Development with HTML5
Mobile Web Development with HTML5Mobile Web Development with HTML5
Mobile Web Development with HTML5Roy Clarkson
 
Mobile Web Applications using HTML5 [IndicThreads Mobile Application Develop...
Mobile Web Applications using HTML5  [IndicThreads Mobile Application Develop...Mobile Web Applications using HTML5  [IndicThreads Mobile Application Develop...
Mobile Web Applications using HTML5 [IndicThreads Mobile Application Develop...IndicThreads
 
Enterprise iPad Development Without Notes
Enterprise iPad Development Without NotesEnterprise iPad Development Without Notes
Enterprise iPad Development Without Notesjaxarcsig
 
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014Maximiliano Firtman
 
Feed Herny developer training : crossplatform and HTML5
Feed Herny developer training : crossplatform and  HTML5Feed Herny developer training : crossplatform and  HTML5
Feed Herny developer training : crossplatform and HTML5Mobile Monday Brussels
 
Introduction to Phonegap
Introduction to PhonegapIntroduction to Phonegap
Introduction to PhonegapAndrei Firoiu
 
The Mobile Web Revealed For The Java Developer
The Mobile Web Revealed For The Java DeveloperThe Mobile Web Revealed For The Java Developer
The Mobile Web Revealed For The Java Developerbalunasj
 
Deep dive into share point framework webparts
Deep dive into share point framework webpartsDeep dive into share point framework webparts
Deep dive into share point framework webpartsPrabhu Nehru
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Todaydavyjones
 
Mobile 2.0 Event: Mobile for the rest of us using Appcelerator Titanium
Mobile 2.0 Event: Mobile for the rest of us using Appcelerator TitaniumMobile 2.0 Event: Mobile for the rest of us using Appcelerator Titanium
Mobile 2.0 Event: Mobile for the rest of us using Appcelerator TitaniumJeff Haynie
 
Appcelerator Titanium at Mobile 2.0
Appcelerator Titanium at Mobile 2.0Appcelerator Titanium at Mobile 2.0
Appcelerator Titanium at Mobile 2.0Jeff Haynie
 
Html5 Application Security
Html5 Application SecurityHtml5 Application Security
Html5 Application Securitychuckbt
 
Xamarin COE by Mukteswar Patnaik
Xamarin COE by Mukteswar PatnaikXamarin COE by Mukteswar Patnaik
Xamarin COE by Mukteswar PatnaikMukteswar Patnaik
 
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...Dart Past Your Competition by Getting Your Digital Experience into Market Fas...
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...Perficient, Inc.
 
An overview of mobile html + java script frameworks
An overview of mobile html + java script frameworksAn overview of mobile html + java script frameworks
An overview of mobile html + java script frameworksSasha dos Santos
 

Ähnlich wie Codestrong 2012 breakout session introduction to mobile web and best practices (20)

Rhodes
RhodesRhodes
Rhodes
 
Griffon for the Enterprise
Griffon for the EnterpriseGriffon for the Enterprise
Griffon for the Enterprise
 
Mobile App Development
Mobile App DevelopmentMobile App Development
Mobile App Development
 
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
 
Mobile Web Development with HTML5
Mobile Web Development with HTML5Mobile Web Development with HTML5
Mobile Web Development with HTML5
 
Mobile Web Applications using HTML5 [IndicThreads Mobile Application Develop...
Mobile Web Applications using HTML5  [IndicThreads Mobile Application Develop...Mobile Web Applications using HTML5  [IndicThreads Mobile Application Develop...
Mobile Web Applications using HTML5 [IndicThreads Mobile Application Develop...
 
Enterprise iPad Development Without Notes
Enterprise iPad Development Without NotesEnterprise iPad Development Without Notes
Enterprise iPad Development Without Notes
 
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
 
Feed Herny developer training : crossplatform and HTML5
Feed Herny developer training : crossplatform and  HTML5Feed Herny developer training : crossplatform and  HTML5
Feed Herny developer training : crossplatform and HTML5
 
Introduction to Phonegap
Introduction to PhonegapIntroduction to Phonegap
Introduction to Phonegap
 
The Mobile Web Revealed For The Java Developer
The Mobile Web Revealed For The Java DeveloperThe Mobile Web Revealed For The Java Developer
The Mobile Web Revealed For The Java Developer
 
Deep dive into share point framework webparts
Deep dive into share point framework webpartsDeep dive into share point framework webparts
Deep dive into share point framework webparts
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
 
Mobile for the rest of us
Mobile for the rest of usMobile for the rest of us
Mobile for the rest of us
 
Mobile 2.0 Event: Mobile for the rest of us using Appcelerator Titanium
Mobile 2.0 Event: Mobile for the rest of us using Appcelerator TitaniumMobile 2.0 Event: Mobile for the rest of us using Appcelerator Titanium
Mobile 2.0 Event: Mobile for the rest of us using Appcelerator Titanium
 
Appcelerator Titanium at Mobile 2.0
Appcelerator Titanium at Mobile 2.0Appcelerator Titanium at Mobile 2.0
Appcelerator Titanium at Mobile 2.0
 
Html5 Application Security
Html5 Application SecurityHtml5 Application Security
Html5 Application Security
 
Xamarin COE by Mukteswar Patnaik
Xamarin COE by Mukteswar PatnaikXamarin COE by Mukteswar Patnaik
Xamarin COE by Mukteswar Patnaik
 
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...Dart Past Your Competition by Getting Your Digital Experience into Market Fas...
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...
 
An overview of mobile html + java script frameworks
An overview of mobile html + java script frameworksAn overview of mobile html + java script frameworks
An overview of mobile html + java script frameworks
 

Mehr von Axway Appcelerator

Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & RoadmapAxway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & RoadmapAxway Appcelerator
 
2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff Haynie2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff HaynieAxway Appcelerator
 
Stop Debating, Start Measuring
Stop Debating, Start MeasuringStop Debating, Start Measuring
Stop Debating, Start MeasuringAxway Appcelerator
 
Mobile & The New Experience Economy (And What it Means for IT)
Mobile & The New Experience Economy  (And What it Means for IT)Mobile & The New Experience Economy  (And What it Means for IT)
Mobile & The New Experience Economy (And What it Means for IT)Axway Appcelerator
 
Apps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really MeansApps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really MeansAxway Appcelerator
 
Appcelerator Presentation Template
Appcelerator Presentation TemplateAppcelerator Presentation Template
Appcelerator Presentation TemplateAxway Appcelerator
 
Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote   jonathan rende, appcelerator's vp of productsCodestrong 2012 keynote   jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote jonathan rende, appcelerator's vp of productsAxway Appcelerator
 
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
Codestrong 2012 keynote   jeff haynie, appcelerator's ceoCodestrong 2012 keynote   jeff haynie, appcelerator's ceo
Codestrong 2012 keynote jeff haynie, appcelerator's ceoAxway Appcelerator
 
Codestrong 2012 keynote how to build a top ten app
Codestrong 2012 keynote   how to build a top ten appCodestrong 2012 keynote   how to build a top ten app
Codestrong 2012 keynote how to build a top ten appAxway Appcelerator
 
Codestrong 2012 breakout session at&t api platform and trends
Codestrong 2012 breakout session  at&t api platform and trendsCodestrong 2012 breakout session  at&t api platform and trends
Codestrong 2012 breakout session at&t api platform and trendsAxway Appcelerator
 
Codestrong 2012 breakout session what's new in titanium studio
Codestrong 2012 breakout session   what's new in titanium studioCodestrong 2012 breakout session   what's new in titanium studio
Codestrong 2012 breakout session what's new in titanium studioAxway Appcelerator
 
Codestrong 2012 breakout session using appcelerator cloud services in your ...
Codestrong 2012 breakout session   using appcelerator cloud services in your ...Codestrong 2012 breakout session   using appcelerator cloud services in your ...
Codestrong 2012 breakout session using appcelerator cloud services in your ...Axway Appcelerator
 
Codestrong 2012 breakout session the role of cloud services in your next ge...
Codestrong 2012 breakout session   the role of cloud services in your next ge...Codestrong 2012 breakout session   the role of cloud services in your next ge...
Codestrong 2012 breakout session the role of cloud services in your next ge...Axway Appcelerator
 
Codestrong 2012 breakout session new device platform support for titanium
Codestrong 2012 breakout session   new device platform support for titaniumCodestrong 2012 breakout session   new device platform support for titanium
Codestrong 2012 breakout session new device platform support for titaniumAxway Appcelerator
 
Codestrong 2012 breakout session mobile platform and infrastructure
Codestrong 2012 breakout session   mobile platform and infrastructureCodestrong 2012 breakout session   mobile platform and infrastructure
Codestrong 2012 breakout session mobile platform and infrastructureAxway Appcelerator
 
Codestrong 2012 breakout session making money on appcelerator's marketplace
Codestrong 2012 breakout session   making money on appcelerator's marketplaceCodestrong 2012 breakout session   making money on appcelerator's marketplace
Codestrong 2012 breakout session making money on appcelerator's marketplaceAxway Appcelerator
 
Codestrong 2012 breakout session live multi-platform testing
Codestrong 2012 breakout session   live multi-platform testingCodestrong 2012 breakout session   live multi-platform testing
Codestrong 2012 breakout session live multi-platform testingAxway Appcelerator
 
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
Codestrong 2012 breakout session   leveraging titanium as part of your mobile...Codestrong 2012 breakout session   leveraging titanium as part of your mobile...
Codestrong 2012 breakout session leveraging titanium as part of your mobile...Axway Appcelerator
 
Codestrong 2012 breakout session i os internals and best practices
Codestrong 2012 breakout session   i os internals and best practicesCodestrong 2012 breakout session   i os internals and best practices
Codestrong 2012 breakout session i os internals and best practicesAxway Appcelerator
 

Mehr von Axway Appcelerator (20)

Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & RoadmapAxway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
 
2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff Haynie2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff Haynie
 
Making the Mobile Mind Shift
Making the Mobile Mind ShiftMaking the Mobile Mind Shift
Making the Mobile Mind Shift
 
Stop Debating, Start Measuring
Stop Debating, Start MeasuringStop Debating, Start Measuring
Stop Debating, Start Measuring
 
Mobile & The New Experience Economy (And What it Means for IT)
Mobile & The New Experience Economy  (And What it Means for IT)Mobile & The New Experience Economy  (And What it Means for IT)
Mobile & The New Experience Economy (And What it Means for IT)
 
Apps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really MeansApps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really Means
 
Appcelerator Presentation Template
Appcelerator Presentation TemplateAppcelerator Presentation Template
Appcelerator Presentation Template
 
Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote   jonathan rende, appcelerator's vp of productsCodestrong 2012 keynote   jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
 
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
Codestrong 2012 keynote   jeff haynie, appcelerator's ceoCodestrong 2012 keynote   jeff haynie, appcelerator's ceo
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
 
Codestrong 2012 keynote how to build a top ten app
Codestrong 2012 keynote   how to build a top ten appCodestrong 2012 keynote   how to build a top ten app
Codestrong 2012 keynote how to build a top ten app
 
Codestrong 2012 breakout session at&t api platform and trends
Codestrong 2012 breakout session  at&t api platform and trendsCodestrong 2012 breakout session  at&t api platform and trends
Codestrong 2012 breakout session at&t api platform and trends
 
Codestrong 2012 breakout session what's new in titanium studio
Codestrong 2012 breakout session   what's new in titanium studioCodestrong 2012 breakout session   what's new in titanium studio
Codestrong 2012 breakout session what's new in titanium studio
 
Codestrong 2012 breakout session using appcelerator cloud services in your ...
Codestrong 2012 breakout session   using appcelerator cloud services in your ...Codestrong 2012 breakout session   using appcelerator cloud services in your ...
Codestrong 2012 breakout session using appcelerator cloud services in your ...
 
Codestrong 2012 breakout session the role of cloud services in your next ge...
Codestrong 2012 breakout session   the role of cloud services in your next ge...Codestrong 2012 breakout session   the role of cloud services in your next ge...
Codestrong 2012 breakout session the role of cloud services in your next ge...
 
Codestrong 2012 breakout session new device platform support for titanium
Codestrong 2012 breakout session   new device platform support for titaniumCodestrong 2012 breakout session   new device platform support for titanium
Codestrong 2012 breakout session new device platform support for titanium
 
Codestrong 2012 breakout session mobile platform and infrastructure
Codestrong 2012 breakout session   mobile platform and infrastructureCodestrong 2012 breakout session   mobile platform and infrastructure
Codestrong 2012 breakout session mobile platform and infrastructure
 
Codestrong 2012 breakout session making money on appcelerator's marketplace
Codestrong 2012 breakout session   making money on appcelerator's marketplaceCodestrong 2012 breakout session   making money on appcelerator's marketplace
Codestrong 2012 breakout session making money on appcelerator's marketplace
 
Codestrong 2012 breakout session live multi-platform testing
Codestrong 2012 breakout session   live multi-platform testingCodestrong 2012 breakout session   live multi-platform testing
Codestrong 2012 breakout session live multi-platform testing
 
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
Codestrong 2012 breakout session   leveraging titanium as part of your mobile...Codestrong 2012 breakout session   leveraging titanium as part of your mobile...
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
 
Codestrong 2012 breakout session i os internals and best practices
Codestrong 2012 breakout session   i os internals and best practicesCodestrong 2012 breakout session   i os internals and best practices
Codestrong 2012 breakout session i os internals and best practices
 

Codestrong 2012 breakout session introduction to mobile web and best practices

  • 1. Introduction to Mobile Web and Best Practices Bryan Hughes, Ph.D. Software Engineer Appcelerator bhughes@appcelerator.com 1
  • 2. About Me • Appcelerator Software Engineer in the JavaScript Engineering group • Previously developed the HTML 5 platform at Particle Code • Ph.D. in Electrical Engineering and Computer Science from Texas Tech University 2
  • 4. Titanium Mobile Target • Provides similar experience to Android and iOS • Not intended for integration into existing web apps/frameworks • Designed specifically for mobile browsers and devices 4
  • 5. Single Page Web App • Apps are hosted on traditional web servers • Users use their device‟ browser to navigate to the URL of the app • Apps are a single page only 5
  • 6. Architecture • Uses HTML 5 technologies to implement the Titanium Mobile API • APIs implemented using Asynchronous Module Definition • Everything is require()‟d var ad = require('Ti/UI/AlertDialog'), foo = new ad({ title: 'Mobile Web Rules!' }); foo.show(); 6
  • 7. User Interface • Controls are composites of other controls • Custom layout Ti.UI.View algorithm Ti.UI.View Ti.UI.ImageView Ti.UI.Label 7
  • 8. File System • Pluggable provider architecture • Fully support directories, binary files, etc. 8
  • 9. Miscellany Titanium API HTML/CSS API Ti.Network.HTTPClient XML HTTP Request (XHR) Ti.Accelerometer devicemotion window event navigator.geolocation and deviceorientation Ti.Geolocation window event Touch Gestures touchstart/move/end window events Ti.Media.VideoPlayer <video> HTML tag 9
  • 11. Tiapp.xml Options <analytics> <use-xhr>true, false</use-xhr> </analytics> <filesystem> <backend>Ti/_/Filesystem/Local</backend> <registry>preload</registry> </filesystem> <Instrumentation>true, false</Instrumentation> <precache> <image>image path</image> <include>file path</include> <require>module id</require> <locale>locale code</locale> </precache> <splash> <enabled>true, false</enabled> <inline-css-images>true, false</inline-css- </splash> <theme>theme name (default is „default‟)</theme> 11
  • 12. Splash Screen Created with HTML+CSS 12
  • 13. Icons • Favicon • Apple Web Applications 13
  • 14. Modules • CommonJS – Can only use Titanium APIs – Compatible with Android and iOS • MobileWeb – Can use any browser features – Will not work on Android and iOS 14
  • 15. Hybrid Apps 100% Written in Titanium 15
  • 16. Debugging Debug like any other web page 16
  • 18. Deploying production minifies code function myFunction(parameterOne, parameterTwo) { • Web server var parameterOnePlusFive = parameterOne + 5; agnostic var parameterTwoPlusTen = parameterTwo + 10; } myFunction(5 + 10, 15 - 20); • Deployment: development or production function myFunction(a,b){var x=a+5,d=b+10}myFunction(15,-5) 18
  • 20. Local Storage • Several APIs use Local Storage • 5mb Local Storage per domain • Exception thrown when exceeded 20
  • 21. Cross Domain HTTP if (Ti.Platform.osname === 'mobileweb') { Ti.Network.httpURLFormatter = function (url) { • Access-Control- // Create prefix from server’s hostname var newPrefix = Allow-Origin location.protocol + '//' + location.host + HTTP header (location.port ? ':' + location.port : ''); // Make sure URL isn't relative • Proxy + URL if (url.indexOf(newPrefix) === -1 && url.indexOf('://') !== -1) { formatter url = newPrefix + '/proxy?url=' + url; console.debug('proxying to ' + url); } return url; } } 21
  • 22. WebViews • Cross domain WebViews are limited • Sites with X- Frame-Options set will not load 22
  • 23. Code Limitations • Variables and functions cannot use DOM names • Titanium objects contain many “hidden” fields 23
  • 24. Code Minification function myFunction(parameterOne, parameterTwo) { var parameterOnePlusFive = parameterOne + 5; var parameterTwoPlusTen = parameterTwo + 10; } • Code minification myFunction(5 + 10, 15 - 20); is not code obfuscation • Code/resources function myFunction(a,b){var x=a+5,d=b+10}myFunction(15,-5) cannot be secured in Mobile Web function myFunction(a, b) { var c = a + 5, d = b + 10; } myFunction(15, -5); 24
  • 25. UI Performance • Two layout passes per layout • Browsers are slower than native • Titanium apps that perform well in Android/iOS may not perform well in Mobile Web 25
  • 26. Miscellany • Unsupported APIs – Database – Contacts – AudioPlayer – Sockets • Facebook Site URL must be set • Everything must be loaded over the network! 26
  • 27. Browser Compatibility • Recommended – Mobile Safari 4.2+ – Android 2.2+ – Chrome for Android – Firefox Mobile for Android – BlackBerry 7+, Playbook • Limited Support – Windows Phone 7.5 (Mango) – BlackBerry 6 (Bold) 27
  • 29. Security • Everything in the app is public information • Don‟t trust the client application • Don‟t put private keys in code 29
  • 30. Layout Optimizations • Reduce the number of controls on screen • Only use vertical and horizontal layouts if they are actually needed • Use basic views whenever possible • Use gradients and solid colors instead of images 30
  • 31. Image Optimizations • Compress JPEG: 371 KB images with the correct CODEC PNG: 2.3 MB • Reduce image dimensions • Reduce color JPEG: 10.14 KB depth PNG: 10.08 KB 31
  • 32. Pre-caching • Cache commonly used source code, images, and text files • Images are encoded as data URIs • Cached resources are inlined in index.html 32

Hinweis der Redaktion

  1. At Appcelerator:* Implemented UI for the Mobile Web platform* Titanium Command Line Interface* Lead for the Titanium Code Processor
  2. The browser does not control navigation in the app
  3. Custom implementation that supports AMD and CommonJS simultaneouslyPrototypal inheritanceDo not try experiment in practice
  4. Ti.UI elements are composites of a combination of HTML elements and other Ti.UI elementsTi.UI.View is the simplest, consisting of a single DIVCustom single-pass, polynomial-based layout algorithmAnimations use matrix3d CSS transforms + requestAnimationFrameSupport for multiple animations on a single element, although none of the other platforms support it
  5. Default provider uses Local StorageCustom lightweight file system implemented on top of Local StorageCan create custom providers that use SQL on a server, indexdb, etc
  6. Resources/mobileweb/splash/splash.html - HTML fragmentsplash.css – splash.html CSS
  7. Favicon:Resources/mobileweb/appicon.pngApple web applications: Resources/mobileweb/apple_startup_images
  8. Mobile Web:Must be AMD modulesDo not recommend using UI libraries such as jQuery or Sensa Touch due to conflicts
  9. Android/iOS app as parent containerMobile Web app as child content
  10. WebKit Inspector, Firebug, F12 Tools, etc in Desktop browserWeb Inspector in iOS 6adblogcat and about:debug in Android Browser
  11. Logs instrumentation data to the consoleEnabled in tiapp.xml
  12. Place the contents of build/mobileweb in the web server’s document rootMinified using uglify-js
  13. Filesystem, Ti.App.Properties, analytics, and others share Local StorageSites installed to the home screen, etc typically get unlimited storageStoring images and other binary data quickly eats up available space
  14. Access-Control-Allow-Origin is set on the serverDo not want to set to * in production for security reasonsIf using a proxy, need to secure proxy against nefarious agents
  15. Many methods do not work and some properties are unavailable if the source is cross domainGoogle, Facebook, Twitter, and others set X-Frame-Options
  16. Example DOM names: window, document, event, location, navigator, parent, screen, selfVaries from browser to browserOverwriting hidden fields can break the appExample fields: properties, constants, constructor, _parent, _childrenRecommend not adding fields to Titanium objects, instead create a wrapper classScreenshot is of the global namespace in Chrome
  17. Minified code can be easily reverse engineeringMinification is used to decreasing load times
  18. First layout pass is our algorithm, second is browser reflowDesktop web can even be slower than native mobile in some cases
  19. Facebook apps must have their Site URL set to the web server via developer.facebook.com
  20. Windows Phone 7.5 does not support touch events, so scrolling is not supportedBlackberry 6 supports all the necessary features, but it so slow as to be unusable in most cases
  21. Application can be spoofed by malicious actorsScreenshot is of minified source codeCaptured via WebKit InspectorBeautified using jsbeautifier.org
  22. Buttons contain 6 elements, but views only contain 1 elementViews receive the same events as buttonsPerformance of gradients vs images is flipped on Mobile Web compared to iOS
  23. Natural images such as photographs should be compressed using JPEGStructural images such as graphs and text should be compressed using PNGImage dimensions should be as low as tolerableColor depth should be as low as tolerable
  24. InliningSubstantially reduces the number of HTTP requestsLoad time when resource is requested is very fastCaching increases in-app performance at the expense of startup time
  25. Too Text HeavyShorten