The following JavaScript is used to detect the Internet Explorer version 8, 7 or 6. It’s returned -1 if the browser is not Internet Explorer. function getInternetExplorerVersion() // Returns the version of Windows Internet Explorer or a -1 // (indicating