PDA

View Full Version : Parsing RSS permission denied error


FJbrian
06-06-2007, 05:33 AM
Script is from O'Reilly's site I adjusted/changed VERY little
It works fine on my computer
Uploaded to my host-
I get "permission denied" on line 186 in IE
In Firefox I just get no action whatsoever, the script does nothing
So....rolling with IE since the error is something tangible to work with in this instance

HTML
http://www.footballhangout.com/Players/rssajax2.html
There "can't" be anything wrong here, I mean there's just nothing to that. I changed from drop down box to input box otherwise...real vanilla there.

Javascript
http://www.footballhangout.com/Players/rssajax3.js
I figure it's gotta be here, the error.

I changed the 4th or 5th line to

var rssurl = "http://news.search.yahoo.com/news/rss?p=" + document.rssform.rssfeed.value +"&ei=UTF&fl=0&x=wrt";


and the 186th line to

xhr.open("GET","http://news.search.yahoo.com/news/rss?p=" + document.rssform.rssfeed.value +"&ei=UTF&fl=0&x=wrt",true);


The change I did is the preceding URL part, previously it fetched document.rssform.rssfeed.value, and the mine type(?) following stuff.

all the other lines are the same

"permission denied", no clue what that means here. Yahoo and Google invite folks to fetch their feeds so it's not that. I'm working within my own site(js) so....where's the prob here? I'm baffled, any ideas?

ETA: Original article link
http://www.xml.com/pub/a/2006/09/13/rss-and-ajax-a-simple-news-reader.html?page=1

GJay
06-06-2007, 09:03 AM
you can't do cross-domain requests with javascript, you'd need to proxy the request with a script on the same domain

FJbrian
06-06-2007, 02:16 PM
Thanks for the reply
I was searching via google late last night and I actually came back to here and saw a post by David KW stating as such and suggesting Google's API. I'm looking at that now. Quite candidly why's that work then?
http://code.google.com/apis/ajaxfeeds

see
http://code.google.com/apis/ajaxfeeds/documentation/
they're using javascript(JSON) so I'm a little confused

Is what you're saying true or not then?(not accusational, looking for info is all, much thanks for the reply) Seems like others say exactly what you just did yet, I see google's code using javascript to do it. Please clarify

A1ien51
06-06-2007, 04:02 PM
You can link to an external JavaScript file which JSON is. You can not link to any other type of file. The JSON request is done by injecting a script tag onto the page and reading the value. I have an example on my blog here: http://radio.javaranch.com/pascarello/2006/07/07/1152292250518.html

If you want to use XML, HTML, text from another domain, you need to use a proxy as dicussed above.

Eric

FJbrian
06-06-2007, 06:44 PM
I don't really understand that blog post Eric
What's instance call back? Didn't you just use yahoo api instead of google api?