diff --git a/src/Pane.js b/src/Pane.js index 513015db..ea462a83 100644 --- a/src/Pane.js +++ b/src/Pane.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import Prefixer from 'inline-style-prefixer'; import stylePropType from 'react-style-proptype'; -const USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Safari/537.2'; +const USER_AGENT = typeof navigator !== 'undefined' ? navigator.userAgent : 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Safari/537.2'; class Pane extends React.Component { constructor(props) { diff --git a/src/Resizer.js b/src/Resizer.js index 463adb2a..61114714 100644 --- a/src/Resizer.js +++ b/src/Resizer.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import Prefixer from 'inline-style-prefixer'; import stylePropType from 'react-style-proptype'; -const USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Safari/537.2'; +const USER_AGENT = typeof navigator !== 'undefined' ? navigator.userAgent : 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Safari/537.2'; export const RESIZER_DEFAULT_CLASSNAME = 'Resizer'; class Resizer extends React.Component { diff --git a/src/SplitPane.js b/src/SplitPane.js index 9aa5410f..084ca2f4 100644 --- a/src/SplitPane.js +++ b/src/SplitPane.js @@ -7,7 +7,7 @@ import stylePropType from 'react-style-proptype'; import Pane from './Pane'; import Resizer, { RESIZER_DEFAULT_CLASSNAME } from './Resizer'; -const USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Safari/537.2'; +const USER_AGENT = typeof navigator !== 'undefined' ? navigator.userAgent : 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Safari/537.2'; function unFocus(document, window) { if (document.selection) {