Richard Wagner
"Professional iPhone and iPod touch Programming: Building Applications for Mobile Safari"
getElementsByTagName(???a??™);
for(var i=0,j=a.length;i%3Cj;i++) {
a[i].setAttribute(???target??™,??™_blank??™);
var img=document.createElement(???img??™);
img.setAttribute(???class??™,??™new-window??™);
img.setAttribute(???src??™,??™data:image/gif;base64,??™+??™R0lGODlhEAAMALMLAL66tBISEjExMdTQy
BoaGjs7OyUlJWZmZgAAAMzMzP///////wAAAAAAAAAAAAAA??™+??™ACH5BAEAAAsALAAAAAAQAAwAAAQ/cMlZq
r2Tps13yVJBjOT4gYairqohCTDMsu4iHHgwr7UA/LqdopZS??™+??™DBBIpGG5lBQH0GgtU9xNJ9XZ1cnsNicRA
Ds=??™);
img.setAttribute(???style??™,??™width:16px!important;
height:12px!important;
border:none!important;??™);
a[i].appendChild(img);
}
})();
Bookmarklets can be handy developer tools to assist in testing and debugging on iPhone. For example,
the following bookmarklet, based on a script created at iPhoneWebDev.com , gives you View Source
functionality (see Figure 10-3 ) on iPhone itself:
javascript:
var sourceWindow = window.open(???about:blank???);
var newDoc = sourceWindow.document;
newDoc.open();
newDoc.write(
???
Source of ??? + document.location.href +
??????user-scalable=0;maximum-scale=0.6667;width=480\???/>