aboutsummaryrefslogtreecommitdiffstats
path: root/src/service/sniffer.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/service/sniffer.js')
-rw-r--r--src/service/sniffer.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/service/sniffer.js b/src/service/sniffer.js
new file mode 100644
index 00000000..c71a9bde
--- /dev/null
+++ b/src/service/sniffer.js
@@ -0,0 +1,24 @@
+'use strict';
+
+/**
+ * @workInProgress
+ * @ngdoc service
+ * @name angular.service.$sniffer
+ * @requires $window
+ *
+ * @property {boolean} history Does the browser support html5 history api ?
+ * @property {boolean} hashchange Does the browser support hashchange event ?
+ *
+ * @description
+ * This is very simple implementation of testing browser's features.
+ */
+angularServiceInject('$sniffer', function($window) {
+ if ($window.Modernizr) return $window.Modernizr;
+
+ return {
+ history: !!($window.history && $window.history.pushState),
+ hashchange: 'onhashchange' in $window &&
+ // IE8 compatible mode lies
+ (!$window.document.documentMode || $window.document.documentMode > 7)
+ };
+}, ['$window']);