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

[IE10] Unable to get property 'split' of undefined or null reference #893

Closed
nicolasthy opened this issue Apr 12, 2018 · 7 comments
Closed
Assignees
Labels

Comments

@nicolasthy
Copy link
Contributor

Expected behaviour

Have Plyr to work on IE10

Actual behaviour

It throws an error in the console
Unable to get property 'split' of undefined or null reference

Environment

  • Browser: Internet Explorer
  • Version: 10
  • Operating System: Windows
  • Version: 10

Steps to reproduce

  • Run any website with plyr on IE10

Solution

The error comes from the defaults.js file where window.navigator.language is undefined.
I found a solution that should do the work:

...
// Captions settings
captions: {
    active: false,
    language: window.navigator.language && window.navigator.language.split('-')[0],
},
...
@friday
Copy link
Collaborator

friday commented Apr 12, 2018

Looks solid. I don't have any IE10 testing setup any longer, but MDN confirms it. Maybe you could make this a PR?

@nicolasthy
Copy link
Contributor Author

I don't have access to contributions, had the fix ready but couldn't push on a new branch 😅

@friday
Copy link
Collaborator

friday commented Apr 12, 2018

Only maintainers can create new branches. To create a PR as a non-maintainer you fork the repo, push your changes to a new branch and press "New pull request" from your branches list next to the branch you want to PR.

You can also just browse to the correct file and make the changes in the github text editor, which will fork Plyr and create a PR for you, but this way is probably best to only use for documentation changes since you can't test before.

@nicolasthy nicolasthy mentioned this issue Apr 12, 2018
2 tasks
@nicolasthy
Copy link
Contributor Author

Oh thank you ! I'm used to contribute to repositories in which I have permission to push on new branches.

@nicolasthy
Copy link
Contributor Author

I did some more testing, seems like captions.language is needed elsewhere in the code. Could we give it a default value when window.navigator.language is null?
Something like this:

// Captions settings
captions: {
    active: false,
    language: window.navigator.language ? window.navigator.language.split('-')[0] : 'en'
},

@sampotts
Copy link
Owner

I've merged the PR but will fallback to navigator.userLanguage for IE...

language: (navigator.language || navigator.userLanguage).split('-')[0]

@sampotts
Copy link
Owner

This should be resolved in v3.2.0 . Thanks for your help 👍

leezaweb added a commit to CSIS-iLab/ocean that referenced this issue Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants