javascript - IE can't grab XML from YouTube API v2? -


i have been working on web page takes specific youtube channel's upcoming live events , formats calendar, can click link each video embed player it. in firefox , chrome runs fine, ie can't xml youtube using xmlhttprequest. gives me error sec7118, , tells me requiring cors.

any ideas?

edit

so turns out, ms, glorious thought process, thought xmlhttprequest() wasn't enough them cors, decided create xdomainrequest(), , used until ie11, got around supporting cors xmlhttprequest()(meaning acknowledged access-control-allow-origin in response header).

unfortunately, far can test @ moment, xdomainrequest(), in current implementation, works ie9 , ie10, , requires messing around usable state xml dom object. suspect doesn't work in ie8, because testing file://(local test page) rather http://, api uses.

my code stands is(simplified):

function xmlcorsrequest(url){    var xhr = new xmlhttprequest();   if ("withcredentials" in xhr){     // browsers standard cors support in xmlhttprequest(), e.g. chrome, safari, firefox, ie 11     var xhr = new xmlhttprequest();     xhr.onload = function(){       populateschedule(xhr.responsexml);     };     xhr.open("get",url,true);    }   else if (typeof xdomainrequest != "undefined"){     // ie v <= 10     xhr = new xdomainrequest();     xhr.onload = function(){       xdrparse(xhr.responsetext);     };     xhr.open("get",url);    } else {     // no cors support @     return null;   }   xhr.send(); }  function xdrparse(rawxmlastext) {   var xmldoc = new window.activexobject("microsoft.xmldom");   xmldoc.async = "false";   xmldoc.loadxml(rawxmlastext);   populateschedule(xmldoc); } 

the function populateschedule() called once request loaded, , xml dom object created. grab upcoming live event entry tags, , sort through them creating multi-dimensional array video ids(the v parameter youtube video), start times, descriptions, , statuses, can create table showing details.

i noticed couple more problems ie:

it couldn't grab innertext value of xml dom object node, textcontent required work across browsers(that i've tested).

regular expressions don't work supposed time @ least.after turning start date of youtube event(which presented date , time in utc) normal date object, called using tolocalestring(). attempted slice off last :00 represented seconds(i didn't need them). normally, expression match should have been /:\d\d(?=\s)/(replaced nothing); because ie ie, somehow using "zeroes" weren't 0 somehow "digits", creating unknown characters between each actual character, , couldn't check following characters, expression became /:[^\d]*\d[^\d]*\d[^\s\d:]*\s/(i replaced space).

firefox strange. when tolocalestring() used, rather stating date in mm/dd/yyyy fashion, returns full day of week, month, dath of month followed comma, year, , time though normally(e.g. thursday, march 27, 2014 10:00 am).

these aren't things need with, figured stumbling across use findings.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -