From d8047beab5722ec926e7491699ec6e4bb31c115d Mon Sep 17 00:00:00 2001 From: Martin Widmann Date: Fri, 30 Mar 2012 11:16:24 +0200 Subject: [PATCH] added cross site support for IE which isn't covered in jQuery, made the google docs URI protocol-relative (http://paulirish.com/2010/the-protocol-relative-url/) to avoid the 'Requests must be targeted to the same scheme as the hosting page.' issue in IE (http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx) --- source/js/timeline.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/source/js/timeline.js b/source/js/timeline.js index f2ce7d3..e84d498 100755 --- a/source/js/timeline.js +++ b/source/js/timeline.js @@ -1959,9 +1959,20 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') { //https://spreadsheets.google.com/feeds/list/0Agl_Dv6iEbDadGRwZjJSRTR4RHJpanE2U3lkb0lyYUE/od6/public/values?alt=json // https://docs.google.com/a/digitalartwork.net/spreadsheet/ccc?hl=en_US&key=0Agl_Dv6iEbDadGRwZjJSRTR4RHJpanE2U3lkb0lyYUE&rm=full#gid=0 var _key = VMM.Util.getUrlVars(raw_data)["key"]; - var _url = "https://spreadsheets.google.com/feeds/list/" + _key + "/od6/public/values?alt=json"; - - VMM.getJSON(_url, VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData); + var _url = "//spreadsheets.google.com/feeds/list/" + _key + "/od6/public/values?alt=json"; + + if ( $.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) { + // Use Microsoft XDR + var xdr = new XDomainRequest(); + xdr.open("get", _url); + xdr.onload = function() { + var json = $.parseJSON( xdr.responseText ); + VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData( json ); + } + xdr.send(); + } else { + VMM.getJSON(_url, VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData); + } },