Do you mean in the browser, or PhoneGap? This should work- I've done it several times.

Could you provide a simple testcase so we can look into it?