Fix bug when detecting browser version

This problem manifests in IE11 on Windows 8.
Added error catching in code that might fail if a new browser comes out,
or one of the UA strings changes.