refactor out browser detection code

[#57379194]