SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 249 | Next

Richard Wagner

"Professional iPhone and iPod touch Programming: Building Applications for Mobile Safari"

setAttribute(???src??™%2C??™data%3Aimage%2Fgif%3Bbase64%2C??™%2B??™R0lGODlhEAA
MALMLAL66tBISEjExMdTQyBoaGjs7OyUlJWZmZgAAAMzMzP%2F%2F%2F%2F%2F%2F%2FwAAAAAAAAAAAAAA
??™%2B??™ACH5BAEAAAsALAAAAAAQAAwAAAQ%2FcMlZqr2Tps13yVJBjOT4gYairqohCTDMsu4iHHgwr7UA%2FL
qdopZS??™%2B??™DBBIpGG5lBQH0GgtU9xNJ9XZ1cnsNicRADs%3D??™)%3Bimg.setAttribute(???style??™%2C??™w
idth%3A16px!important%3Bheight%3A12px!important%3Bborder%3Anone!important%3B??™)%3Ba%
5Bi%5D.appendChild(img)%3B%7D%7D)()%3B
Note that while this URI encoded script works on iPhone, it (along with other iPhone-specific bookmarklets
in this chapter) still will not work on Windows Safari. Additionally, when you synch with Windows
Safari, iPhone bookmarklets can occasionally behave unexpectedly.
An iPhone user can then use this self-contained ???applet??? on any page in which they wish to transform
the links. Notice that the image itself is encoded in a data URL, so that the script is not dependent on any
external files.
While the entire script needs to be condensed into a single string of commands, Safari is actually
smart enough to convert the hard breaks for you when a multilined script is pasted into the URL box.
Just make sure each statement is separated by a semicolon. Therefore, the following code, which is much
easier to work with and debug, would still execute properly when pasted directly into the URL box:
Chapter 10: Packaging Apps as Bookmarks: Bookmarklets and Data URLs
225
javascript:(
function(){
var a=document.


Pages:
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261