<?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>Think Lamp &#187; Web Design</title>
	<atom:link href="http://www.think-lamp.com/category/webdesign/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.think-lamp.com</link>
	<description>Everything Linux Apache Php Mysql</description>
	<lastBuildDate>Sun, 05 Sep 2010 00:50:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>jQuery, Accessing Iframe data and the shortcomings of $(document).ready</title>
		<link>http://www.think-lamp.com/2010/09/jquery-accessing-iframe-data-and-the-shortcomings-of-document-ready/</link>
		<comments>http://www.think-lamp.com/2010/09/jquery-accessing-iframe-data-and-the-shortcomings-of-document-ready/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 00:28:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.think-lamp.com/?p=206</guid>
		<description><![CDATA[Have an iFrame inside a document and you need to access the iframe data and make decisions based on that data&#8230; Few problems Same Origin Policy Frame Load incomplete. No. 1 is easy, if the two Top Level Domain aren&#8217;t the same, you cannot read the iframe data. Even for the same domain and different [...]]]></description>
			<content:encoded><![CDATA[<p>Have an iFrame inside a document and you need to access the iframe data and make decisions based on that data&#8230;<br />
Few problems</p>
<ol>
<li> <a href="http://en.wikipedia.org/wiki/Same_origin_policy" target="_blank">Same Origin Policy </a></li>
<li>Frame Load incomplete.</li>
</ol>
<p><span id="more-206"></span></p>
<p>No. 1 is easy, if the two Top Level Domain aren&#8217;t the same, you cannot read the iframe data. Even for the same domain and different subdomains, one needs to write the following on the top of both client and the server:</p>
<pre class="brush: jscript;"> document.domain = &quot;mytopleveldomain.com&quot; </pre>
<p>No. 2</p>
<p>How to determine that the iframe has loaded completely in order to scan data off it ?<br />
Well,</p>
<pre class="brush: jscript;"> &lt;code&gt;$(document).ready(function()&lt;/code&gt;</pre>
<p>will surely tell you if the page has loaded, but it won&#8217;t wait for the iframe(s) inside the parent document to finish loading, before returning true.</p>
<p>One may think, this might work:</p>
<pre class="brush: jscript;">
$(document).ready(function() {

     $('#myIframe').ready(function() {
                // ALL CODE GOES HERE
     });
});
</pre>
<p>BUT, it doesn&#8217;t. The above code will tell you ONLY that the iframe loading has started, but won&#8217;t<br />
tell you if its done.</p>
<p>Solution:<br />
Well, the OLD window.onload to the rescue:</p>
<pre class="brush: jscript;">
window.onload = function () {
    $('#myIframe').ready(function() {
                // ALL CODE GOES HERE
     });
};
</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.think-lamp.com%2F2010%2F09%2Fjquery-accessing-iframe-data-and-the-shortcomings-of-document-ready%2F&amp;linkname=jQuery%2C%20Accessing%20Iframe%20data%20and%20the%20shortcomings%20of%20%24%28document%29.ready"><img src="http://www.think-lamp.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.think-lamp.com/2010/09/jquery-accessing-iframe-data-and-the-shortcomings-of-document-ready/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image with same path doesn&#8217;t show up due to cache in browsers</title>
		<link>http://www.think-lamp.com/2009/09/image-with-same-path-doesnt-show-up-due-to-cache-in-browsers/</link>
		<comments>http://www.think-lamp.com/2009/09/image-with-same-path-doesnt-show-up-due-to-cache-in-browsers/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 15:50:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://www.think-lamp.com/?p=191</guid>
		<description><![CDATA[Browsers are designed to think that Images with same name don&#8217;t change rapidly so regularly.  This creates a problem in some cases where you have to reuse a  specific name Or a specific location for a system. One such case can be a social network which is designed in a way where the profile images [...]]]></description>
			<content:encoded><![CDATA[<p>Browsers are designed to think that Images with same name don&#8217;t change rapidly so regularly.  This creates a problem in some cases where you have to reuse a  specific name Or a specific location for a system.<br />
<span id="more-191"></span><br />
One such case can be a social network which is designed in a way where the profile images are always:</p>
<p><strong>http://www.mysite.com/users/images/user123/profile.jpg</strong></p>
<p>Now, on changing this image, sometimes browsers don&#8217;t clear cache and thus show the last image. In Order to solve this, use a random number at the end of the image location and you will be able to see that image. as browsers will not cache it.</p>
<p><strong>http://www.mysite.com/users/images/user123/profile.jpg?123</strong></p>
<p>One method that I used is:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$stamp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$imageLocation</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.mysite.com/users/images/user123/profile.jpg?'</span><span style="color: #339933;">.</span><span style="color: #000088;">$stamp</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$imageLocation</span></pre></div></div>

<p>This should work.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.think-lamp.com%2F2009%2F09%2Fimage-with-same-path-doesnt-show-up-due-to-cache-in-browsers%2F&amp;linkname=Image%20with%20same%20path%20doesn%26%238217%3Bt%20show%20up%20due%20to%20cache%20in%20browsers"><img src="http://www.think-lamp.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.think-lamp.com/2009/09/image-with-same-path-doesnt-show-up-due-to-cache-in-browsers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Rasmus Lerdorf is talking about AJAX</title>
		<link>http://www.think-lamp.com/2009/02/what-rasmus-lerdorf-is-talking-about-ajax/</link>
		<comments>http://www.think-lamp.com/2009/02/what-rasmus-lerdorf-is-talking-about-ajax/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 08:08:58 +0000</pubDate>
		<dc:creator>kinjal.ch</dc:creator>
				<category><![CDATA[AJAX]]></category>

		<guid isPermaLink="false">http://www.think-lamp.com/?p=136</guid>
		<description><![CDATA[Are you blindly following any ajax library to work your way. Take a look what Rasmus is talking about AJAX He follows the rule of simplicity as he described in his framework approach. The very basic of ajax structure - Javascript function createRequestObject() { var ro; var browser = navigator.appName; if(browser == &#8220;Microsoft Internet Explorer&#8221;){ [...]]]></description>
			<content:encoded><![CDATA[<p>Are you blindly following any ajax library to work your way.</p>
<p>Take a look what <a href="http://news.php.net/php.general/219164" target="_blank">Rasmus is talking about AJAX</a></p>
<p>He follows the rule of simplicity as he described in his framework approach.</p>
<p><span id="more-136"></span></p>
<p>The very basic of ajax structure -</p>
<p><strong>Javascript</strong></p>
<p>function createRequestObject() {</p>
<p>var ro;</p>
<p>var browser = navigator.appName;</p>
<p>if(browser == &#8220;Microsoft Internet Explorer&#8221;){</p>
<p>ro = new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);</p>
<p>}else{</p>
<p>ro = new XMLHttpRequest();</p>
<p>}</p>
<p>return ro;</p>
<p>}</p>
<p>var http = createRequestObject();</p>
<p>function sndReq(action) {</p>
<p>http.open(&#8216;get&#8217;, &#8216;rpc.php?action=&#8217;+action);</p>
<p>http.onreadystatechange = handleResponse;</p>
<p>http.send(null);</p>
<p>}</p>
<p>function handleResponse() {</p>
<p>if(http.readyState == 4){</p>
<p>var response = http.responseText;</p>
<p>var update = new Array();</p>
<p>if(response.indexOf(&#8216;|&#8217; != -1)) {</p>
<p>update = response.split(&#8216;|&#8217;);</p>
<p>document.getElementById(update[0]).innerHTML = update[1];</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p><strong>HTML</strong></p>
<p>&lt;a href=&#8221;javascript:sndReq(&#8216;foo&#8217;)&#8221;&gt;[foo]&lt;/a&gt;</p>
<p>&lt;div id=&#8221;foo&#8221; /&gt;</p>
<p>server side script(<strong>rpc.php</strong>) -</p>
<p>switch($_REQUEST['action']) {</p>
<p>case &#8216;foo&#8217;:</p>
<p>/* do something */</p>
<p>echo &#8220;foo|foo done&#8221;;</p>
<p>break;</p>
<p>&#8230;</p>
<p>}</p>
<p>Thats all. Everything else is just building on top of this.</p>
<p>Source : <a href="http://news.php.net/php.general/219164" target="_blank">http://news.php.net/php.general/219164</a></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.think-lamp.com%2F2009%2F02%2Fwhat-rasmus-lerdorf-is-talking-about-ajax%2F&amp;linkname=What%20Rasmus%20Lerdorf%20is%20talking%20about%20AJAX"><img src="http://www.think-lamp.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.think-lamp.com/2009/02/what-rasmus-lerdorf-is-talking-about-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
