Also improve browser support by testing for each feature instead of checking the user agent. Also improve error handling by using promises. Fixes #2939 Fixes #4194