A few iPhone Safari notes
Some notes on Safari on the iPhone, from the perspective of a web developer:
- Poking around the DOM, I don’t see any special objects, with the possible exception of
window.offscreenBuffering(set totrue). - Bookmarklets work, although you have to go through the bookmarks menu to get to them.
- The javascript shell bookmarklet is tantalizingly close to working, but doesn’t actually evaluate what you’ve entered when you hit enter - it just goes to a newline. This is probably easy to fix.
- Update: the problem appears to be the fact that you only get an onkeypress event after you hit enter on the virtual keyboard, and even then the keyCode is equal to 0. I tried modifying the script to execute whenever keyCode is 0, but that made Safari crash! Does that make me the first civilian to crash Safari?
- Safari crashes are handled gracefully - the main screen fades back in, and you can jump right back into Safari. It will then load page you were visiting when it crashed.
- Drag and drop, and other behaviors based on picking up mousemove events, don’t work. CSS-based element drag and drop doesn’t work either. Dragging one finger around the iPhone’s version of Safari causes the window to scroll, and that’s it. I assume that scroll events do work. I’m sure somebody is already working on a version of drag and drop based on window scrolling.
- For documents with no width set, the iPhone uses a default width of 980px.
- alert() works.
I’ll post more things as I discover them, or feel free to add your own in the comments.