logo       

[Flickr APIs] Re: xmlhttprequest help: msg#00067

web.flickr.api

Subject: [Flickr APIs] Re: xmlhttprequest help

Ok, today I talked with a Mozilla developer friend (Marcio Galli), and
we came up with a version of the Flickr Badge for Sets using
xmlhttprequest, that runs on Mozilla and IE locally, and also on
Mozilla(with some modifications) when online...

http://www.mamata.com.br/flickrtests/badgetest.html

The problem is that the user has to:

1- modify the signed.applets.codebase_principal_support preference of
the browser to true (via about:config)
1- see 2 popups asking permission

There is another way to do this in Mozilla using SOAP, but probably
I'll have to ask for the Flickr guys to add my domain to the
web-scripts-access.xml file, as I did with the crossdomain.xml
file(for flash). I am planning to work on a demo using this type of
communication Moz-Flickr next week. Meanwhile, there is this usefull
url http://www.mozilla.org/projects/webservices/ wich contains many
information if someone wants to do something in this area.

I am guessing that probably I will need a WSDL file also, but maybe I'm wrong...

[]s


On Mon, 23 Aug 2004 05:56:42 -0300, Fabricio Zuardi
<fabricio-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:
> Hi,
>
> I am a happy flickr user and hobbyist enthusiast developer, a newbie
> starting to play with Flickr API. I am using this XML HTTPRequest
> tutorial as a starting point:
> http://developer.apple.com/internet/webcontent/xmlhttpreq.html
>
> I have made a simple javascript test app that calls
> flickr.photosets.getPhotos to generate an html code with all
> thumbnails from a set. The code is below:
>
> -----------------
> var url =
> "http://www.flickr.com/services/rest/?method=flickr.photosets.getPhotos";
> var user_id = "49503114626@N01"
> var photoset_id = "3913"
> var api_key = "72fadaff0fad605613c6caeb8a09f85d"
> var params = "&api_key="+api_key+"&photoset_id="+photoset_id
> var req;
>
> function loadXMLDoc(url) {
> // branch for native XMLHttpRequest object
> if (window.XMLHttpRequest) {
> req = new XMLHttpRequest();
> req.onreadystatechange = processReqChange;
>
> netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
> req.open("GET", url, true);
> req.send(null);
> // branch for IE/Windows ActiveX version
> } else if (window.ActiveXObject) {
> req = new ActiveXObject("Microsoft.XMLHTTP");
> if (req) {
> req.onreadystatechange = processReqChange;
> req.open("GET", url, true);
> req.send();
> }
> }
> }
>
> function processReqChange() {
> // only if req shows "loaded"
> if (req.readyState == 4) {
> // only if "OK"
> if (req.status == 200) {
> var xmlResponse = req.responseXML;
> if(xmlResponse.documentElement){
> var idphotos = []
> var photoset =
> xmlResponse.documentElement.firstChild //photoset
> for(var photo =
> photoset.firstChild;photo!=null; photo = photo.nextSibling){
>
> idphotos.push(photo.getAttribute("id"))
> }
> printPhotos(idphotos)
> }else{
> alert("error")
> }
> } else {
> alert("There was a problem retrieving the XML data:\n" +
> req.statusText);
> }
> }
> }
> function printPhotos(ids){
> var str = ""
> for (var i=0; i<ids.length;i++){
> str +="<a
> href='http://www.flickr.com/photo.gne?id="+ids[i]+";'><img
> src='http://www.flickr.com/photos/"+ids[i]+"_"+user_id+"_s.jpg'
> /></a>"
> }
> document.write(str)
> }
> loadXMLDoc(url+params)
> -----------------
>
> It works fine if I run it locally on IE, but on Firefox I receive the
> follow error:
>
> Error: [Exception... "'Permission denied to get property
> XMLDocument.documentElement' when calling method:
> [nsIOnReadystatechangeHandler::handleEvent]" nsresult: "0x8057001e
> (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no]
>
> Anyone knows what could be wrong, or some other way to make it?
>
> PS: I dont have one API Key yet, I had requested one by email but
> meanwhile I am using a borrowed one from the flickr demo pages :(
>
> --
> Fabricio C Zuardi
> http://idomyownstunts.blogspot.com
>


--
Fabricio C Zuardi
http://idomyownstunts.blogspot.com



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise