-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Made vjs.get work with xDomain in IE < 10 #1095
Conversation
Thanks! What is the error you're seeing in the older versions of IE that this fixes? |
It enables IE to send cross domain xml requests like an ad request to Google DFP: Most modern browsers can use the "withCredentials" flag, which older IE versions does not support. |
Cool! When @heff gets back we'll take a look and see about getting this one pulled in. |
We can find someone on the team to take a look tomorrow. |
looks like it's the way to go http://www.html5rocks.com/en/tutorials/cors/#toc-making-a-cors-request. |
try { | ||
request.open('GET', url); | ||
request.withCredentials = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this always be set?
…ture/IE-get-xDomain
The withCredentials flag allows the request to include cookies, but could be configured with a parameter. Just noted yesterday as well that IE11 requires the request to be open before we can set the withCredentials flag. |
That's weird that IE11 requires that. However, yes, it should be a configuration. We don't want to always set credentials to true because sometimes cookies are disabled or whatever. |
@skogby do we still need to update this to open the request before setting withCredentials? And can we make it so that setting is configurable? |
Yes, we only want the |
Just pushed some updates that changed the order of "open" and "withCredentials" in addition to making it not being sent as default. |
I think I'm seeing this problem too with IE9 and subtitles hosted on a different sub-domain. Are these changes likely to get merged and released any time soon? |
Looks good. Can you also add the |
As I mentioned above, I've run into this problem on IE9 when I have subtitles hosted on a different sub-domain. I've just built a test page using the code in this PR and I can confirm that it fixes my problem. Is there anything I can do to help get this merged and released? |
Ah, cool. For some reason I thought it did support that property. Carry on then. |
The commit integrates the changes in [1] which are in turn based on this video.js pull request [2]. This should fix a problem whereby cross-domain Ajax GET requests from within video.js did not work for Internet Explorer < v10. This should mean that subtitles (which are hosted on a sub-domain of `futurelearn.com` in production, i.e. `ugc.futurelearn.com`) work with the video.js player on earlier versions of Internet Explorer. [1] https://github.com/Futurelearn/video.js/compare/v4.5.2-with-IE-get-xDomain-fix [2] videojs/video.js#1095
This is working for me in everything but IE8, where it errors out now when loading captions. Can anyone else test this in IE8 and verify? If you run a local server and test the index.html file (copied from index.html.example) in /sandbox/, you should be able to play the video, then turn on captions and see captions. But this now breaks in IE8. I logged out the onError function in vjs.get, and in true IE8 fashion, no information is passed to the error handler. So I have no idea what might be causing this. But it is clear that IE8 is now using XDomainRequest in instead of the XMLHttpRequest/Msxml2.XMLHTTP shim it previously was. If there was a way to continue that when IE8 is used, that might fix this issue. I'm not sure if that's the best approach though. |
So to clarify a little, IE8 does support native XMLHttpRequests (xhr1 not xhr2). So apparently XDomainRequest doesn't work in all the same situations XMLHttpRequest does. Are there clear times where we should be using one and not the other? |
Basically, XDomainRequest is needed because XHR 1 doesn't understand CORS headers. So, XDomainRequest should be used whenever you're making a request to another domain, which is set up with CORS headers. However, I think XDRs should be able to do whatever XHR 1 does for same domain requests as well (as long as the requests are simple as only |
That's good to know. But for some reason XDR isn't working in the index.html example, while XHR is. If someone can try the example and verify that'd be helpful, so I know it's not just me. Found this writeup, but I don't believe any of these should be affecting the index.html example.
|
Added a more explicit MIME type note in setup. Moved to a footnote and made comment more verbose to avoid confusion.
@heff I haven't had a chance to try it on the example, but I have my own version working OK in IE8 including subtitles. In fact the reason I needed the fix was because my subtitles are hosted on a different domain. I don't know whether it's significant, but I'm instantiating the player via JS and passing a |
Thanks @floehopper, that'd be helpful. I tried forcing my local server to send text/plain for vtt files, and that didn't help the issue. And IE8 is still passing zero information to the onerrror handler, so I'm not sure what to try next. I don't think anythings out of the ordinary with my example, especially since xmlhttprequest is working. I wonder if it's worth checking if the file is cross domain and only using xdomainrequest in that case. |
…js into dbmedialab-feature/IE-get-xDomain
Did some reorganization of the code.
I made some updates and submitted a pull request to this branch. dbmedialab-archive#1 If anyone can test if these changes still work for them, that'd be great. |
@heff As I've mentioned [1] over on your PR, subtitles don't work any more on a different sub-domain since your most recent changes. |
Changed to used XDomainRequest only when url is cross domain Tested and it seems to be working, I currently don't have access to a IE9 computer though.
Ok, I think I have this fixed in dbmedialab-archive#2 |
I'm going to test this now. |
Just to re-iterate what I've said on @heff's latest PR, I've created a new test page [1] for my use case (where subtitles are on a sub-domain) and tested that subtitles work OK on the following: Win XP/IE8, Win7/IE9, Win8/IE10, Win8.1/IE11, OSX10.9/Firefox29, OSX10.9/Safari7 & OSX10.9/Chrome34. Good work and thanks! [1] http://code.gofreerange.com/video-test/video.js-vzaar-subtitles-3.html |
Woo! Thanks for testing it out. Going to pull this in then. |
This has been merged into master and will go out with the next minor release. |
This fix makes the videojs get function work in older versions of IE by using XDomainRequest