Weather RSS Feed does not work on Firefox 3
Hi there,
I tried to use the weather RSS Feed provided by yahoo and followed the way on the page http://developer.yahoo.com/weather/
.
The following code is what I done with the XML from feed(http://weather.yahooapis.com/forecastrss?p=ASXX0089&u=c). It works very well on IE6. I can pull out all the data contained in the XML file and reuse it. But on Firefox 3 , the javascript console always give a error message highlighted in red.
"uncaught exception: Access to restricted URI denied (NS_ERROR_DOM_BAD_URI)
[Break on this error] xmlDoc.load("http://weather.yahooapis.com/forecastrss?p=ASXX0089&u=c");"
Could you please help me to fix this problem.
Many thanks.
<CODE>
<script type="text/javascript">
// predeclare to prevent strict js error.
var xmlDoc;
// For IE based browsers:
if (window.ActiveXObject) {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
}
// For Mozilla based (standards compliant) browsers:
else if (document.implementation && document.implementation.createDocument) {
xmlDoc = document.implementation.createDocument("","doc",null);
}
// Turn off asynchronus download.
// In other words, load the entire file before trying to do anything with it.
xmlDoc.async="false";
xmlDoc.onreadystatechange=verify;
xmlDoc.load("http://weather.yahooapis.com/forecastrss?p=ASXX0089&u=c");
function verify()
{
// 0 Object is not initialized
// 1 Loading object is loading data
// 2 Loaded object has loaded data
// 3 Data from object can be worked with
// 4 Object completely initialized
if (xmlDoc.readyState != 4 )
{ document.getElementById("loading").innerHTML = '';
}
}
</CODE>
by
3 Replies