diff --git a/src/scripts/lib/is-supported.js b/src/scripts/lib/is-supported.js new file mode 100644 index 0000000..825a3c7 --- /dev/null +++ b/src/scripts/lib/is-supported.js @@ -0,0 +1,8 @@ +module.exports = function() { + // Borrowed wholesale from https://github.com/defunkt/jquery-pjax + return window.history && + window.history.pushState && + window.history.replaceState && + // pushState isn’t reliable on iOS until 5. + !navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]|WebApps\/.+CFNetwork)/) +} diff --git a/tests/scripts/lib/is-supported.js b/tests/scripts/lib/is-supported.js new file mode 100644 index 0000000..7ca141b --- /dev/null +++ b/tests/scripts/lib/is-supported.js @@ -0,0 +1,8 @@ +var tape = require("tape") + +var isSupported = require("../../../src/scripts/lib/is-supported.js") + +tape("test isSupported method", function(t) { + t.true(isSupported(), "well, we run test on supported browser, so it should be ok here") + t.end() +})