简体   繁体   English

无法在FF或IE中加载XML,但可以在Chrome中运行

[英]XML Not Loading in FF or IE, Works In Chrome

Please take a look at the following link: http://www.nba.com/warriors/audiotrack_test_000005.html?mark-jackson-on-the-dan 请查看以下链接: http : //www.nba.com/warriors/audiotrack_test_000005.html?mark-jackson-on- the- dan

This works properly (meaning it appends the audio track onto the page) in Chrome but fails at different points in Internet Explorer and Firefox. 此功能在Chrome中正常运行(意味着它将音频轨道附加到页面上),但在Internet Explorer和Firefox中的不同点失败。

In IE it fails at the line: 在IE中,该行失败:

xmlDoc=loadXMLDoc("http://api.soundcloud.com/users/goldenstatewarriors/tracks?client_id=02db8e29aa2fb5bf590f478b73137c67");

In FF it fails at the line below that: 在FF中,它在下面的行失败:

x=xmlDoc.getElementsByTagName("track");

I've never had a cross-browser XML loading problem like this before, but this is the first time I am loading XML from a server other than my own. 我以前从未遇到过像这样的跨浏览器XML加载问题,但这是我第一次从非我自己的服务器加载XML。

Any solutions available? 有可用的解决方案吗? SoundCloud also offers JSON but I have not worked with that much... SoundCloud还提供JSON,但我没有做太多工作。

I've looked at it in Firefox and firebug shows that the response from api.soundcloud is returned as 我在Firefox中查看了它,萤火虫显示api.soundcloud的响应返回为

content-type: text/html.

The XMLHttpRequest in your loadXMLDoc gets the reponse in the responseText property and not the responseXML. loadXMLDoc中的XMLHttpRequest在responseText属性而不是responseXML中获取响应。

Looking on the soundcloud website (never used it myself) you can specify the required format by changing your call to 在soundcloud网站上查看(我自己从未使用过),可以通过将调用更改为来指定所需的格式

xmlDoc=loadXMLDoc("http://api.soundcloud.com/users/goldenstatewarriors/tracks?client_id=02db8e29aa2fb5bf590f478b73137c67&format=xml");

adding the 添加

&format=xml

to the call made it work for me in firefox at least. 至少让它在firefox中对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM