tailieunhanh - Lập trình iphone chuyên nghiệp part 21

Chapter 10: Packaging Apps as Bookmarks: Bookmarklets and Data URLs Ngoài chức năng JavaScript, bạn cũng có thể lưu trữ một trang web hoặc thậm chí một ứng dụng hoàn chỉnh bên trong của một bookmark. Các dữ liệu: giao thức cho phép bạn mã hóa toàn bộ một trang nội dung của - HTML, CSS, JavaScript, và hình ảnh - bên trong một URL duy nhất. | Chapter 10 Packaging Apps as Bookmarks Bookmarklets and Data URLs 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. 226 Chapter 10 Packaging Apps as Bookmarks Bookmarklets and Data URLs Constraints and Issues with Using Data URLs 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. However you cannot package PHP MYSQL or any server-side applications in a bookmark. Any Web application that requires server access for data or application functionality will need to have a way to pack and go 1 use client-side JavaScript for application functionality and 2 package up a snapshot of the data and put it in a form accessible from a client script. The application must be entirely self-contained. Therefore every external resource the application needs such as images style sheets and .js libraries must be encoded inside of the main HTML file. External resources that are referenced multiple times cannot be cached. Therefore each separate reference must be encoded and embedded in the file. Images must be encoded as base64 though the conversion will increase their size by approximately 33 percent. The maximum size of a data URL in Mobile Safari is technically 128KB .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.