Book Image

Mobile Web Performance Optimization

By : S. S. Niranga
Book Image

Mobile Web Performance Optimization

By: S. S. Niranga

Overview of this book

With users increasingly accessing the web on mobile devices, it’s crucial to make sure your website is built to seamlessly fit this radical change in user behavior. Mobile Web Performance Optimization is designed to help you do exactly that – it’s been created to help you build fast, and mobile-user-friendly websites and applications. Featuring guidance through a range of techniques and tools essential to modern mobile development, this accessible guide will make sure you’re delivering a seamless and intuitive experience for your website’s users. Begin by exploring the fundamental components of mobile web design and website optimization, before learning how to put the concepts into practice. Featuring cross-platform solutions, insights on developing lightweight yet robust UI, and insights on how to successfully manage data, this application development book takes you through every stage in the development process – so you can be confident that you’re asking the right questions and using the best tools in the most effective way. By the end, you’ll understand implicitly what it means to ‘build for performance’- you’ll be a more confident developer, capable of building projects that adapt to a changing world.
Table of Contents (14 chapters)
Mobile Web Performance Optimization
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Preface

This book is for anyone who has basic knowledge of web development and who wants to enhance their knowledge on mobile website performance optimization. By reading this book, a user will get to know how to measure their website's performance, the tools they can use to debug and monitor their website, and the tips and tricks to optimize their website.

What this book covers

Chapter 1, Pillars of Mobile Web Performance Optimization, discusses mobile history and why mobile web optimization is necessary. Also, we will talk about the three main pillars that are important in the mobile world, and also discuss the major browsers and popular OSes in the market.

Chapter 2, Mobile Web Optimization Essentials, explains the importance of reducing HTTP requests and enabling Gzip on the server and its benefits. We will discuss the importance of image optimization and the tools we can use. Also, we will see content management, the importance of UX, and how it affects a mobile site.

Chapter 3, How to Optimize Yours Mobile Website, discusses HTML5 and CSS3 and how to use their features for performance optimization. We will especially talk about the importance of hardware acceleration and GPU, CSS3 animations versus JavaScript animations, and how to use iconic fonts instead of images. After that, we will see how to use media queries and display none in CSS. We will also explore CSS preprocessors and the importance of minifying CSS and JS.

Chapter 4, Caching and Optimizing, shows how the caching mechanism works. After that, we will see how a developer should call JavaScript and CSS files and why we should avoid empty source and link attributes. Then we will have a brief introduction to CSS and JavaScript frameworks. The later part of the chapter explains how we can optimize JavaScript to gain performance and the importance of reducing DOM elements.

Chapter 5, Monitoring and Debugging Our Website, demonstrates how to use profiling tools such as GPU Overdraw Walkthrough and GPU Rendering Walkthrough. After that, we will see the features of browser's DevTools and how we can remote debug our website using devices actually connecting to our PC. Also, we will discuss the Firefox, Safari, and IE developer toolbar and how we can use them for debugging. In the later part of the chapter, we will go through the Google emulator and see how we can use it as a testing environment. Finally, we will see how to get a performance score and rating for our website using Google PageSpeed and YSlow.

Chapter 6, Managing Third-Party Components, teaches you how to check 404 errors in our website, why it is important to eliminate 404 errors, and how we can do that. Not only 404, but we should also learn and understand 300, 400, and 500 error messages as well. Then, we will discuss CDN networks and the benefits that we can get using a CDN network. Then we will cover how to open and close connection works and the importance of offloading to Wi-Fi. After that, we will discuss screen rotation and how we can use it to optimize our website. Finally, we will see Adobe Flash and you are recommended not to use it.

Chapter 7, Tips and Tricks, discusses why we should build for performance and how we can convince our clients to approve a budget for performance. Also, in the chapter, we will see what the limitations of our design tools are and how we can get the best out of them. Finally, we will discuss the New Relic mobile app, a tool that we can use to monitor our application's performance. The tool generates a very detailed report, which helps developers in many aspects.

What you need for this book

The software used in this book are as follows:

Software required

Free/Proprietary

Download links to the software

Tiny png

Free

https://tinypng.com/

ImageOptim

Free

https://imageoptim.com/

Kraken

Free

https://kraken.io/

Font Awesome Icons

Free

https://fortawesome.github.io/Font-Awesome/icons/

IcoMoon Icons

Free

https://icomoon.io/

SASS

Free

http://sass-lang.com/

LESS

Free

http://lesscss.org/

GPU Overdraw Walkthrough

Free

 

Browser DevTools Performance Tools

Free

 

Firefox Developer Tools

Free

 

IE 11 Developer Tools

Free

 

Safari Developer toolbar

Free

 

YSlow

Free

http://yslow.org/

Web page test

Free

www.webpagetest.org

Who this book is for

This book is for anyone who has basic knowledge of web development and who wants to enhance their knowledge of mobile website performance optimization.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "In Apache, you can add the following code to the .htaccess file."

A block of code is set as follows:

# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
ddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml

# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Go to the taskbar and click on Server Manager."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/MobileWebPerformanceOptimization_ColoredImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.