Chapter 18. Debugging and Performance

Debugging and performance optimization are the two scariest activities in the mobile web development world, after testing—but don’t worry, there are lots of ways to tame them. We discussed tools and techniques for testing in Chapter 4. In this chapter we will focus on more advanced features for debugging and performance.

Debugging

For years I’ve complained that web developers were second-class citizens (compared with native developers), in terms of the availability of tools and documentation. Fortunately, in the last year or so vendors have begun to realize that web developers need more tools for debugging and performance measurement, and the tools catalog available today is growing.

Server-Side Debugging

To debug server-side detection, adaptation, or content delivery scripts, we can use some HTTP tools before turning to the real devices.

User agent spoofing

User agent spoofing tools allow us to fool the server about the browser that is currently requesting the web page by changing how the client identifies itself to the server. For example, using a desktop browser, we can say it is a mobile browser and the server will fall into the trap. We can use these tools to debug mobile redirects and detection frameworks, as covered in Chapter 9, without the need of real devices or even emulators.

We can then browse to any website and see how the server manages the user agent and which content it serves. (Remember to go back to the default user agent after finishing ...

Get Programming the Mobile Web, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.