开发者

Why is this Javascript not being compatible with Google Chrome?

开发者 https://www.devze.com 2023-03-10 05:30 出处:网络
Every time I try to view my webpage in Google Chrome I get this: XMLHttpRequest cannot load file:tickercontent.txt?bustcache=1306951376114. Cross origin requests are only supported for HTTP.

Every time I try to view my webpage in Google Chrome I get this:

XMLHttpRequest cannot load file:tickercontent.txt?bustcache=1306951376114. Cross origin requests are only supported for HTTP. ajaxticker.js:63Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101

And nothing displays on the page at all.

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.开发者_JAVA百科ajaxobj.onreadystatechange=function(){instanceOfTicker.initialize()}
        this.ajaxobj.open('GET', url, true)
        this.ajaxobj.send(null)
    }
}

Line 63 would be "this.ajaxobj.send(null)"


The behavior is by-design. Possible solutions are discussed in chromium issue 47416.

The only current workaround is to launch chrome with --allow-file-access-from-files

0

精彩评论

暂无评论...
验证码 换一张
取 消