summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorGabriel Luong2013-05-22 11:40:36 (EDT)
committer Anton McConville2013-05-22 11:54:03 (EDT)
commit7ffe3414d419a09ea3be79a3dd4a911bdb3a708d (patch)
treeddbc4be32bf33eff205819e5b4aa59c826a1725a
parent70e5c38b51b05d51783b5e931c5f5249c8b0d323 (diff)
downloadorg.eclipse.orion.client-7ffe3414d419a09ea3be79a3dd4a911bdb3a708d.zip
org.eclipse.orion.client-7ffe3414d419a09ea3be79a3dd4a911bdb3a708d.tar.gz
org.eclipse.orion.client-7ffe3414d419a09ea3be79a3dd4a911bdb3a708d.tar.bz2
Added browser compatibility check.
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/orion/browserCompatibility.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/browserCompatibility.js b/bundles/org.eclipse.orion.client.ui/web/orion/browserCompatibility.js
new file mode 100644
index 0000000..e3e8c70
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/browserCompatibility.js
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * @license
+ * Copyright (c) 2011, 2013 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0
+ * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+ *
+ *******************************************************************************/
+/*global window document define login logout localStorage orion */
+/*jslint browser:true sub:true*/
+
+function isSupportedBrowser() {
+ var userAgent = navigator.userAgent;
+ var isSupported = false;
+ var browserData = {
+ 'Chrome': {
+ regExp: /chrome\/(\d+)/i,
+ minVersion: 24
+ },
+ 'Firefox': {
+ regExp: /firefox\/(\d+)/i,
+ minVersion: 4
+ },
+ 'MSIE': {
+ regExp: /msie\s(\d+)/i,
+ minVersion: 10
+ },
+ 'Safari': {
+ regExp: /version\/(\d+).*?safari/i,
+ minVersion: 5
+ }
+ };
+
+ for (var browser in browserData) {
+ var matches = userAgent.match(browserData[browser].regExp);
+ if (matches) {
+ if (matches[1] >= browserData[browser].minVersion) {
+ isSupported = true;
+ }
+ }
+ }
+
+ return isSupported;
+}