input: Cross-browser compatibility

Close #852