documentElement.innerHTML%29%29%3B
Chapter 10: Packaging Apps as Bookmarks: Bookmarklets and Data URLs
226
Go to www.wrox.com for a useful set of bookmarklets that you can use.
Storing an Application in a Data URL
In addition to JavaScript functionality, you can also store a Web page or even a complete application
inside of a bookmark. The data: protocol allows you to encode an entire page??™s content ??” HTML, CSS,
JavaScript, and images ??” inside a single URL. To be clear, data URLs store, not a simple link to a remote
page, but the actual contents of the page. This data URL can then be saved as a bookmark. When users
access this bookmark, they can interact with the page whether or not they have Internet access. The
implications are significant ??” you can use data URLs to package certain types of Web applications and
get around the live Internet connection requirement.
Figure 10-3: Viewing a page??™s source on iPhone
Chapter 10: Packaging Apps as Bookmarks: Bookmarklets and Data URLs
227
Constraints and Issues with Using Data URL s
While the potential of data URLs is exciting for the developer, make sure you keep the following
constraints and issues in mind before working with them:
You can store client-side technologies ??” such as HTML, CSS, JavaScript, and XML ??” inside a
data URL.
Pages:
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264