O'Reilly logo

Beginning iOS Application Development with HTML and JavaScript® by Richard Wagner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required