Chapter 13

Packaging Apps as Bookmarks: Bookmarklets and Data URLs

WHAT YOU WILL LEARN IN THIS CHAPTER:

  • Discovering what bookmarklets are
  • Creating offline apps using bookmarklets
  • Encoding your images and source code

Because IOS web apps function inside the Safari environment, there are two seemingly obvious restrictions for the web developer: You must live with the built-in capabilities of the Safari on IOS browser; and you need a constant Wi-Fi (or, for iPhone/iPad, 3G) connection in order to run any application.

As you will discover in Chapter 15, you can use HTML5 offline storage capabilities to get around the dependency on a live connection. However, there are also two lesser-known technologies — bookmarklets and data URLs — that can provide similar results. These technologies have actually been around for years, but they have tended to exist on the periphery of mainstream web development. Developers are now reexamining these two technologies to maximize the potential of the IOS web application platform.

Bookmarklets (short for bookmark applets) are mini JavaScript “applets” that can be stored as a bookmark inside Safari. A data URL is a technique for storing an entire web page or application (pages, styles, images, data, and scripts) inside a single URL, which can then be saved as a bookmark inside Safari. This application-in-a-bookmark can then be accessed in offline mode. You probably won’t want to package heavy-duty enterprise-level apps in a bookmarklet, but for smaller ...

Get Beginning iOS Application Development with HTML and JavaScript® 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.