/** * A javascript file used to detect the current browser's platform. Offers a couple * of utility functions for modifying the mozilla.com pages to offer the best * downloads for visitors. * */ /* * Do platform detection */ var PLATFORM_OTHER = 0; var PLATFORM_WINDOWS = 1; var PLATFORM_LINUX = 2; var PLATFORM_MACOSX = 3; var PLATFORM_MAC = 4; var PLATFORM_ANDROID = 5; var gPlatform = PLATFORM_WINDOWS; if (navigator.platform.indexOf("Win32") != -1 || navigator.platform.indexOf("Win64") != -1) gPlatform = PLATFORM_WINDOWS; else if (navigator.platform.indexOf("armv7l") != -1) gPlatform = PLATFORM_ANDROID; else if (navigator.platform.indexOf("Linux") != -1) gPlatform = PLATFORM_LINUX; else if (navigator.userAgent.indexOf("Mac OS X") != -1) gPlatform = PLATFORM_MACOSX; else if (navigator.userAgent.indexOf("MSIE 5.2") != -1) gPlatform = PLATFORM_MACOSX; else if (navigator.platform.indexOf("Mac") != -1) gPlatform = PLATFORM_MAC; else gPlatform = PLATFORM_OTHER; /** * Gets whether or not the client is an officially unsupported platform * * Officially unsupported platforms are Windows 95, 98, ME and NT 4.x * * The regular expression matches: * * - Win16 * - Win9x * - Win95 * - Win98 * - WinNT (not followed by version or followed bu version < 5) * - Windows ME * - Windows CE * - Windows 9x * - Windows 95 * - Windows 98 * - Windows 3.1 * - Windows 4.10 * - Windows NT (not followed by version or followed by version < 5) * - Windows_95 */ var gPlatformUnsupported = /(Win(16|9[x58]|NT( [1234]| [^0-9]|[^ -]|$))|Windows ([MC]E|9[x58]|3\.1|4\.10|NT( [1234]| [^0-9]|[^ ]|$))|Windows_95)/.test(navigator.userAgent); /** * When a user comes to our download page, we try to detect their platform. If * successful, this function will hide all the links for other platforms in an effort * to give people the best choice to download. * * @param string tag ID to search for