Basically I have a Safari Extension and I want to deliver slightly different code to Safari 6 from that that I use for Safari 5.1...
Is there a way I can detect the browser version from within an extension?
Basically I have a Safari Extension and I want to deliver slightly different code to Safari 6 from that that I use for Safari 5.1...
Is there a way I can detect the browser version from within an extension?
Copyright © 2021 Jogjafile Inc.
If your Safari 6-specific code depends on a new API in Safari 6, you should use feature detection to determine whether or not you can use the feature. For example, if you wanted to address Safari 6's new Reader API:
If feature detection won't work for you, you can use
window.navigator.appVersion
to determine the major version of Safari. For example:But feature detection is always preferable.