为什么此Javascript与Google Chrome不兼容?

时间:2011-06-01 18:09:05

标签: javascript google-chrome syntax-error identifier

每当我尝试在Google Chrome浏览器中查看我的网页时,我都会这样:

XMLHttpRequest无法加载文件:tickercontent.txt?bustcache = 1306951376114。仅支持HTTP的跨源请求。 ajaxticker.js:63未捕获错误:NETWORK_ERR:XMLHttpRequest异常101

页面上根本没有显示任何内容。

ajax_ticker.prototype.getXMLfile=function(){
    this.ajaxobj=createAjaxObj() //recreate Ajax object (IE seems to require it)
    if (this.ajaxobj){
        var instanceOfTicker=this
        var url=this.xmlfile+"?bustcache="+new Date().getTime()
        this.ajaxobj.onreadystatechange=function(){instanceOfTicker.initialize()}
        this.ajaxobj.open('GET', url, true)
        this.ajaxobj.send(null)
    }
}

第63行是“this.ajaxobj.send(null)”

1 个答案:

答案 0 :(得分:0)

行为是按设计的。 chromium issue 47416中讨论了可能的解决方案。

目前唯一的解决方法是使用--allow-file-access-from-files启动chrome