Note: always try to detect the specific behavior you're trying to fix, instead of targeting it with isSafari?
As a last resort, detect Safari with this regex:
var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
It uses negative look-arounds and it excludes Chrome, Edge, and all Android browsers that include the Safari
name in their user agent.