Managing browser detection in script instead of based on jquery