Archive for May, 2008

When creating a search API consider OpenSearch

Posted on May 23rd, 2008 in General Web Dev | No Comments »

APIs tend to be very arbitrary things. Even a well-documented and executed API can differ drastically from another of the same quality in the same category. For a current project I had to integrating YouTube’s API into our system (for searching and embedding videos) and found it a breeze. Using their documentation I found that I could get the data any way I want – atom, rss, json, json-p, etc. Not only this, but everything from their videos, comments, and related media was very well organized and layed-out (who would have though less of something from the guys at Google). In actuality it wasn’t the smart minds at Google that thought up this efficient data structure – they were just following the creative-commons licensed OpenSearch specification created by Amazon’s A9. A format that is used by a lot of companies from Amazon to Firefox to Wikipedia.

A week later my new project was to integrate the API from another large video site. Their API, while perfectly fine for a custom solution was as arbitrary as any other – which got me thinking: “Wouldn’t it be great if this company had also integrated OpenSearch?” This would have made implementing them into our system effortless using my existing code-base instead of a full day extra work an additional code. Their data structure is already similar and all it would require would be some reordering and renaming of nodes (obviously a little bit more work than that, but not much!)

As the Web matures, standards are becoming more and more important and unless your product has a specific reason for having it’s own proprietary API (and there may be a good reason but I didn’t see one in this case), you may find you’ll lose business or popularity to others that are more “open”. In most cases, a company would have happily used an open standard or format, saving more work for themselves and developers working with their system – they just weren’t aware that one existed. So this is my post to you about open search. Read about it, embrace it, and let’s use open formats before creating our own!

Dynamically creating an iframe in Internet Explorer for remote form submissions

Posted on May 13th, 2008 in General Web Dev, Internet Explorer, JavaScript | 3 Comments »

I’ve been doing a lot of remote iframe work as of late and while creating some functionality that submits a form to a dynamically generated iframe I quickly found that in IE6/7 you cannot target an iframe created with document.createElement('iframe');. You must instead use innerHTML to write out the iframe inside another element.

Oh IE, we will never understand you!

Update: Max commented that you can indeed use document.createEelement and still target iframes in IE, you just need to create them in this way document.createElement('<iframe name="iframeName">');. Still ├╝ber quirky but slightly better than the innerHTML approach. Kudos Max!