I was just fiddling around with my old fake command line in a web page thingy that I first posted here months ago (inspired by the awesome goosh!). Learned a few interesting things in the process:
On the iPhone, I was still getting a partial shadow along the top edge of the text input field.
-webkit-appearance: nonegets rid of this.WebKit on the iPhone seems to ignore calls to
focus()on a text input element that happen in an onload handler or timer. There does not seem to be any workaround. I can certainly see why they wouldn’t want half the web pages in the world sliding up a keyboard as soon as they finished loading, but if you actually want to do this for a specific reason, there’s no apparent way to do so.In HTML 5, you can use the
autofocusattribute on an input to completely avoid having to write gnarly JavaScript just to focus an input field. However, this doesn’t work on the iPhone either.My “solution” to not being able to autofocus the text input field was to add
placeholder="Tap here"to the input.HTML 5 has the best DOCTYPE ever:
<!DOCTYPE HTML>No, seriously, that’s it.
I’m sure most of you web-jockeys probably know all this already. But I don’t get out much.
