16 lines
665 B
JavaScript
Raw Normal View History

2015-04-29 11:02:32 +02:00
'use strict';
2015-04-21 19:38:17 +02:00
function supportsHistory() {
/*! taken from modernizr
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
* changed to avoid false negatives for Windows Phones: https://github.com/rackt/react-router/issues/586
*/
var ua = navigator.userAgent;
2015-04-29 11:02:32 +02:00
if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) {
2015-04-21 19:38:17 +02:00
return false;
}
2015-04-29 11:02:32 +02:00
return window.history && 'pushState' in window.history;
2015-04-21 19:38:17 +02:00
}
module.exports = supportsHistory;