move history api feature detection to utils
parent
dbbd82579e
commit
e4faf54804
|
@ -1,3 +1,5 @@
|
||||||
|
import { supportsHistoryAPI } from '../utils/device.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads and writes the URL based on reveal.js' current state.
|
* Reads and writes the URL based on reveal.js' current state.
|
||||||
*/
|
*/
|
||||||
|
@ -98,7 +100,7 @@ export default class Location {
|
||||||
else if( currentSlide ) {
|
else if( currentSlide ) {
|
||||||
// If we're configured to push to history OR the history
|
// If we're configured to push to history OR the history
|
||||||
// API is not avaialble.
|
// API is not avaialble.
|
||||||
if( config.history || !window.history ) {
|
if( config.history || supportsHistoryAPI === false ) {
|
||||||
window.location.hash = this.getHash();
|
window.location.hash = this.getHash();
|
||||||
}
|
}
|
||||||
// If we're configured to reflect the current slide in the
|
// If we're configured to reflect the current slide in the
|
||||||
|
|
|
@ -12,4 +12,6 @@ export const isAndroid = /android/gi.test( UA );
|
||||||
// up slides. Zoom produces crisper results but has a lot of
|
// up slides. Zoom produces crisper results but has a lot of
|
||||||
// xbrowser quirks so we only use it in whitelisted browsers.
|
// xbrowser quirks so we only use it in whitelisted browsers.
|
||||||
export const supportsZoom = 'zoom' in testElement.style && !isMobile &&
|
export const supportsZoom = 'zoom' in testElement.style && !isMobile &&
|
||||||
( isChrome || /Version\/[\d\.]+.*Safari/.test( UA ) );
|
( isChrome || /Version\/[\d\.]+.*Safari/.test( UA ) );
|
||||||
|
|
||||||
|
export const supportsHistoryAPI = typeof window.history.replaceState === 'function' && !/PhantomJS/.test( UA );
|
Loading…
Reference in New Issue