ecomfe / ub-ria

RIA base for union business
GNU General Public License v2.0
94 stars 34 forks source link

tpl.js支持ie10、9、8跨域加载模板 #274

Closed yanghuabei closed 7 years ago

yanghuabei commented 7 years ago

接入cdn后,.tpl.html文件的加载需要跨域,服务端设置好允许跨域头之后,需要tpl.js提供跨域支持。ie10、9、8需要使用XDomainRequest实现。

// 跨域时,兼容ie10、9、8
if (isCrossRigion && window.XDomainRequest) {
    var xdr = new window.XDomainRequest();
    xdr.open('GET', url);
    xdr.onload = function () {
        addTemplate(xdr.responseText);
    };
}
// 非跨域或非ie浏览器
else {
}
otakustay commented 7 years ago

话说我们线上的模板不是打包成一个js文件的么……最关键的是不是text插件要改才是王道

yanghuabei commented 7 years ago

额 是的。我搞错了,那些没打包的模板使用text插件加载的....

otakustay commented 7 years ago

text的可以用InlineText,要的话找我好了

Gray Zhang

在 2016年9月23日 at 下午1:58:15, hiby (notifications@github.com) 写到:

Closed #274 https://github.com/ecomfe/ub-ria/issues/274.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ecomfe/ub-ria/issues/274#event-799928866, or mute the thread https://github.com/notifications/unsubscribe-auth/AAnCPedfcNUxJyUiCsyLTs_0lJPiUMw7ks5qs2p3gaJpZM4KEn33 .