I recently got the Opera browser for the nintendo DS, with the idea of creating a touch screen interface for controlling the audio I'm piping around the home (php, apache, applescript, itunes, airtunes & airfoil - more on all of this later). I was hoping that the software would have the 'XmlHttpRequest' class in its Javascript implementation, which is a pretty common way of creating AJAX web pages. Unfortunately, it doesn't. What makes debugging the browser all the more tricky is the fact that you can't get to any Javascript console, so it really is trial and error.
Thankfully, tamwayne over at this thread on the opera ds forum has come up with a solution. It's actually a method I used a few years back before AJAX was the next big thing (and when I wasn't aware of the XmlHttp class and its variations). Basically, tamwayne's method defines a new class called 'IFramelHttpRequest'. This class can then be used to request xml from other pages. A dynamic iframe is used to load xml from the other page, and the content of this iframe is then passed to a callback. Nicely done tamwayne.
Unfortunately I've being having problems using this method. The iframe 'onload' function appears to be called before the iframe is populated with the new XML. This may be due to the slight delay in rendering my xml (it has to talk to itunes to generate the XML). My work around was to edit the onload function in the iFrameHttpRequest object. I use the setTimeout() function to call the callback function after a small delay, to account for the iframe loading.
When calling the callback i pass the name of the iframe. This callback then uses the name to read the iframe contents. this seems to do the trick.
apologies if the above was hard to follow. I'll post the source once it's all done
Thursday, 15 March 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment