Optimize isSafari check