Skip to content

Commit

Permalink
@gkatsev added null checks around navigator.userAgent. closes #3502
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatsev committed Aug 5, 2016
1 parent 1ff9f38 commit f947ed7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CHANGELOG
* @misteroneill added ghooks to run linter on git push ([view](https://github.com/videojs/video.js/pull/3459))
* @BrandonOCasey removed unused base-styles.js file ([view](https://github.com/videojs/video.js/pull/3486))
* @erikyuzwa, @gkatsev updated CSS build to inlcude the IE8-specific CSS from a separate file instead of it being inside of sass ([view](https://github.com/videojs/video.js/pull/3380)) ([view2](https://github.com/erikyuzwa/video.js/pull/1))
* @gkatsev added null checks around navigator.userAgent ([view](https://github.com/videojs/video.js/pull/3502))

--------------------

Expand Down
2 changes: 1 addition & 1 deletion src/js/tech/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ class Html5 extends Tech {
*/
supportsFullScreen() {
if (typeof this.el_.webkitEnterFullScreen === 'function') {
const userAgent = window.navigator.userAgent;
const userAgent = window.navigator && window.navigator.userAgent || "";

// Seems to be broken in Chromium/Chrome && Safari in Leopard
if ((/Android/).test(userAgent) || !(/Chrome|Mac OS X 10.5/).test(userAgent)) {
Expand Down
3 changes: 2 additions & 1 deletion src/js/utils/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import document from 'global/document';
import window from 'global/window';

const USER_AGENT = window.navigator.userAgent;
const USER_AGENT = window.navigator && window.navigator.userAgent || "";
const webkitVersionMap = (/AppleWebKit\/([\d.]+)/i).exec(USER_AGENT);
const appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null;

Expand All @@ -30,6 +30,7 @@ export const IOS_VERSION = (function() {
if (match && match[1]) {
return match[1];
}
return null;
}());

export const IS_ANDROID = (/Android/i).test(USER_AGENT);
Expand Down

0 comments on commit f947ed7

Please sign in to comment.