Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do a nullcheck for navigator. default to null for ios_version #3502

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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