logo       

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

web.flickr.api

Subject: Re: [Flickr APIs] Re: xmlhttprequest help

Yes Stewart, I understand the problems of using api calls for this
type of things, my intention with this tests is not to provide some
cut'n paste javascript for blogs, the final goal is really a XUL
extension/app, I am just trying to understand better how the things
works first, so I can explore better the possibilities later.

[]s

On Fri, 27 Aug 2004 03:49:06 -0700, Stewart Butterfield
<stewart.butterfield-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:
> For the record, this worked in firefox for me as well (after
> about:config'ing the noted param to 'true').
>
> I'm a little nervous about things like this and our poor servers -
> perhaps a guideline along the lines of:
>
> '' FlickrAPI applications which load and display data unprompted
> (i.e., things which get included on people's web pages and
> automatically run) should only load as much as they need in order to
> be interesting (and can load more if interacted with, or on the user's
> request).''
>
> If it is something that someone is deliberately choosing to see, like
> say the rainbow drawing widget in processing, then load is less of an
> issue (since people will do that less often, no matter how cool it
> is).
>
> But if a few dozen high-traffic blogs are loading a few dozen images
> based on a bunch of API calls every time one of their pages loads,
> even if the readers don't even see the stuff (i.e., it is below the
> fold) then ... that's not such a great thing.
>
> We should try to formalize that at some point in the future :)
>
> (Fabricio - that was a tangent - I definitely don't want to discourage
> you and I think what you're doing is fine. I'd also be really curious
> to see how far people could go with a XUL-based flickr image browser
> ....)
>
>
> On Fri, 27 Aug 2004 05:02:32 -0300, Fabricio Zuardi
> <fabricio-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:
> > 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
> > _______________________________________________
> > Flickr-APIs mailing list
> > Flickr-APIs-PH6dntW41FXEJFt6QFEIHw@xxxxxxxxxxxxxxxx
> > http://lists.iamcal.com/cgi-bin/mailman/listinfo/flickr-apis
> >
> _______________________________________________
> Flickr-APIs mailing list
> Flickr-APIs-PH6dntW41FXEJFt6QFEIHw@xxxxxxxxxxxxxxxx
> http://lists.iamcal.com/cgi-bin/mailman/listinfo/flickr-apis
>


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



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

News | FAQ | advertise