<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Molindo Techblog &#187; JavaScript</title>
	<atom:link href="http://techblog.molindo.at/category/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://techblog.molindo.at</link>
	<description>Molindo Techblog - formerly known as talk-on-tech.blogspot.com</description>
	<lastBuildDate>Fri, 05 Feb 2010 16:06:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Access to Lyricwiki.org&#8217;s REST API with pure JavaScript</title>
		<link>http://techblog.molindo.at/2008/07/access-to-lyricwikiorgs-rest-api-with-pure-javascript.html</link>
		<comments>http://techblog.molindo.at/2008/07/access-to-lyricwikiorgs-rest-api-with-pure-javascript.html#comments</comments>
		<pubDate>Tue, 01 Jul 2008 14:24:00 +0000</pubDate>
		<dc:creator>Stefan Fußenegger</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Lyricwiki]]></category>

		<guid isPermaLink="false">http://tech.molindo.at/2008/07/access-to-lyricwikiorgs-rest-api-with-pure-javascript.html</guid>
		<description><![CDATA[My objective of today was to get rid of these ugly warnings issued by IE while accessing lyricwiki.org&#8217;s REST API using a small Flash thingy. This SWF file is needed to circumvent JavaScript&#8217;s cross domain limitation. This security feature avoids that JavaScript from host A loads files from host B. This absolutely makes sense, just [...]]]></description>
			<content:encoded><![CDATA[<p>My objective of today was to get rid of these ugly warnings issued by IE while accessing <a href="http://www.lyricwiki.org/">lyricwiki.org&#8217;s</a> <a href="http://lyricwiki.org/LyricWiki:REST">REST API</a> using a small Flash thingy. This SWF file is needed to circumvent JavaScript&#8217;s cross domain limitation. This security feature avoids that JavaScript from host A loads files from host B. This absolutely makes sense, just imagine how a client connected to the internet and a company&#8217;s intranet could be used to steal confidential data. However, this limitation does not apply to JavaScript files loaded with the script tag. Therefore, I <a href="http://lyricwiki.org/User_talk:Sean_Colombo#JavaScript_format_for_REST_API">suggested</a> to add a JavaScript format to the REST API in order to dynamically access the API using a technique called &#8220;<a href="http://ajaxpatterns.org/On-Demand_Javascript">On-Demand JavaScript</a>&#8220;.</p>
<p>First, I wanted to make the API extension output JavaScript code. However, I found out &#8211; know this i probably the right moment to admit that I am not a JavaScript guru <img src='http://techblog.molindo.at/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  &#8211; that <a href="http://en.wikipedia.org/wiki/JSON">JSON</a> files can be included by the script tag as well, which makes them suitable for On-Demand JavaScript as well. However, both formats are implemented (JSON used by default) and transparently interchangeable.</p>
<p>The result of my work are 4 files (<a href="http://molindo.at/files/lyricwiki-v2.tar.gz">download</a>), hosted on <a href="http://www.molindo.at/">my company&#8217;s website</a>:</p>
<ul>
<li><span style="text-decoration: line-through;"><a href="http://molindo.at/api.php.txt">api.php</a> (extension code for the current API, <a href="http://fcwy.at/lyricwiki/api.php?artist=The+Rolling+Stones&amp;song=19th+Nervous+Breakdown&amp;fmt=js">live demo on different host</a>)</span></li>
<li><a href="http://molindo.at/files/lyricwiki.js">lyricwiki.js</a> (client side demo code)<a href="http://molindo.at/lyricwiki.js"><br />
</a></li>
<li><a href="http://molindo.at/files/staticAPI.html">staticAPI.html</a> (simple demo)</li>
<li><a href="http://molindo.at/files/ondemandAPI.html">ondemandAPI.html</a> (cooler demo)</li>
</ul>
<p>(Code is tested with IE6, IE7, FF3 &#8211; <a href="http://www.mozilla.com/firefox/">download now! <img src='http://techblog.molindo.at/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </a> &#8211; and FF2, <a href="http://creativecommons.org/licenses/publicdomain/">Public Domain Dedication</a>)</p>
<p>EDIT: updated files to optionally use <a href="http://en.wikipedia.org/wiki/JSONP#JSONP">JSONP</a>. (<a href="http://www.blogger.com/comment.g?blogID=9056272353724997210&amp;postID=5936602994821240003">see comments</a>) I did not use the proposed json_encode() method, as it&#8217;s only available with PHP versions &gt;= 5.2.0.</p>
<p>EDIT2: Yay! My proposal finally made its way into <a href="http://lyricwiki.org/api.php?fmt=json&amp;func=getSong&amp;artist=The_Rolling_Stones&amp;song=19th_Nervous_Breakdown">production</a>. I therefore changed the files to use the production API instead of my little test script. Additionally, we already moved from the pure txt to the json format on <a href="http://www.songtexte.com/">Songtexte.com</a>. This is really cool, as we got rid of this little flash thingy that caused warnings in IE.</p>
<p>EDIT3: Forgot to mention that JSONP wasn&#8217;t implemented. However, I&#8217;m supposed to get access to Lyricwiki&#8217;s API source repository real soon. I will definetely try to implement the optional callback parameter.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.molindo.at/2008/07/access-to-lyricwikiorgs-rest-api-with-pure-javascript.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
