<?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>phoenixheart - portfolio &#38; more &#187; Client stuffs</title> <atom:link href="http://www.phoenixheart.net/category/client-stuffs/feed/" rel="self" type="application/rss+xml" /><link>http://www.phoenixheart.net</link> <description>phoenixheart - portfolio &#38; more</description> <lastBuildDate>Wed, 25 Aug 2010 03:02:03 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.1</generator> <script type="text/javascript">/*<![CDATA[*/if(typeof Meebo=="undefined"){Meebo=function(){(Meebo._=Meebo._||[]).push(arguments)};(function(q){var args=arguments;if(!document.body){return setTimeout(function(){args.callee.apply(this,args)},100);}var d=document,b=d.body,m=b.insertBefore(d.createElement('div'),b.firstChild);s=d.createElement('script');m.id='meebo';m.style.display='none';m.innerHTML='<iframe id="meebo-iframe"></iframe>';s.src='http'+(q.https?'s':'')+'://'+(q.stage?'stage-':'')+'cim.meebo.com/cim/cim.php?network='+q.network;b.insertBefore(s,b.firstChild);})({network:'phoenixheartnet_bo16we'});}/*]]>*/</script> <item><title>Deal with browser incompliance using jQuery</title><link>http://www.phoenixheart.net/2009/04/deal-with-browser-incompliance-using-jquery/</link> <comments>http://www.phoenixheart.net/2009/04/deal-with-browser-incompliance-using-jquery/#comments</comments> <pubDate>Mon, 27 Apr 2009 07:34:51 +0000</pubDate> <dc:creator>phoenix.heart</dc:creator> <category><![CDATA[Client stuffs]]></category> <category><![CDATA[Featured]]></category> <category><![CDATA[css]]></category> <category><![CDATA[jQuery]]></category><guid
isPermaLink="false">http://www.phoenixheart.net/?p=256</guid> <description><![CDATA[Without a doubt, being a serious web guy you want your new site to look perfect on web browsers. Yes, mission would be simple &#8211; or sound simple &#8211; if there wasn&#8217;t something called browser wars for such a long time without any glorious winner (yet). The stupid result is, we poor web designers and [...]]]></description> <content:encoded><![CDATA[<p><span
class="drop-cap">W</span>ithout a doubt, being a serious web guy you want your new site to look perfect on web browsers. Yes, mission would be simple &#8211; or sound simple &#8211; if there wasn&#8217;t something called <a
href="http://en.wikipedia.org/wiki/Browser_wars">browser wars</a> for such a long time without any glorious winner (yet). The stupid result is, we poor web designers and programmers are still hopelessly struggling to keep our sites look the same on <a
href="http://en.wikipedia.org/wiki/Internet_Explorer">Internet Explorer</a> (DIE PIG, DIE!!!), <a
href="http://en.wikipedia.org/wiki/Mozilla_Firefox">Firefox</a>, <a
href="http://en.wikipedia.org/wiki/Opera_(web_browser)">Opera</a>, <a
href="http://en.wikipedia.org/wiki/Safari_(web_browser)">Safari</a>, just to find out that the oh so cool banner suddenly disappears from that new boy <a
href="http://en.wikipedia.org/wiki/Google_Chrome">Chrome</a>. FYI (psst) that was when I decided to stick with web that I started to learn cursing and swearing.</p><p>I am so proud to say that I decided to stop supporting IE 6 to save myself some precious life years and keep my head from getting bald long ago. But still, those guys in Microsoft they have IE 7 and 8 to haunt us. And despite of the so-called W3C standards, each of the remaining major browsers renders the pages differently here and there &#8211; margins, paddings, form elements, and so on. To deal with them, we use &#8220;hacks&#8221;. Perhaps the most well known hack is one below, called &#8220;conditional comments&#8221;:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td
class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--[if IE]&gt;</span>
<span style="color: #808080; font-style: italic;">Stuffs for Internet Explorer all versions</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--[if IE 5]&gt;</span>
<span style="color: #808080; font-style: italic;">Stuffs for Internet Explorer 5</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--[if IE 5.0]&gt;</span>
<span style="color: #808080; font-style: italic;">Stuffs for Internet Explorer 5.0</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--[if IE 5.5]&gt;</span>
<span style="color: #808080; font-style: italic;">Stuffs for Internet Explorer 5.5</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--[if IE 6]&gt;</span>
<span style="color: #808080; font-style: italic;">Stuffs for Internet Explorer 6</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--[if IE 7]&gt;</span>
<span style="color: #808080; font-style: italic;">Stuffs for Internet Explorer 7</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--[if IE 8]&gt;</span>
<span style="color: #808080; font-style: italic;">Stuffs for Internet Explorer 8</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--[if gte IE 5]&gt;</span>
<span style="color: #808080; font-style: italic;">Stuffs for Internet Explorer 5 and up</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--[if lt IE 6]&gt;</span>
<span style="color: #808080; font-style: italic;">Stuffs for Internet Explorer lower than 6</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--[if lte IE 5.5]&gt;</span>
<span style="color: #808080; font-style: italic;">Stuffs for Internet Explorer lower or equal to 5.5</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--[if gt IE 6]&gt;</span>
<span style="color: #808080; font-style: italic;">Stuffs for Internet Explorer greater than 6</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span></pre></td></tr></table></div><p>When this technique is great, it has two limitations. First, only IE is taken into account. When most of the time dealing with IE takes the majority, there are still cases when your sites looks different on Firefox, Safari, Opera etc. Second, the HTML code looks very ugly and unprofessional &#8211; just like we are humbly telling: sorry this is beyond my control&#8230; I must use a hack here&#8230; and here&#8230; sorry again&#8230; <span
id="more-256"></span></p><p>Then today when looking for a better solution, I stumbled upon a <a
href="http://www.tvidesign.co.uk/blog/CSS-Browser-detection-using-jQuery-instead-of-hacks.aspx">much better method</a> that overcomes all of our current problems &#8211; well, sort of. The idea behind it is using jQuery to detect the browser and its version, then add the corresponding class names into the &lt;body&gt; tag. For instance, if the visitor uses Internet Explorer 7, then &#8220;.browserIE&#8221; and &#8220;.browserIE7&#8243; are added. Then, in our CSS we specify the styles for this browser:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td
class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#aPainInThe4ssElement</span>
<span style="color: #00AA00;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/* generic styles for this pain */</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.browserIE7</span> <span style="color: #cc00cc;">#aPainInThe4ssElement</span>
<span style="color: #00AA00;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/* styles for this element on IE 7 */</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.browserFirefox</span> <span style="color: #cc00cc;">#aPainInThe4ssElement</span>
<span style="color: #00AA00;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/* styles for this element on all Firefox browsers */</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.browserSafari2</span> <span style="color: #cc00cc;">#aPainInThe4ssElement</span>
<span style="color: #00AA00;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/* styles for this element on Safari 2 */</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div><p>My hat off to <a
href="http://www.tvidesign.co.uk/meetTeam.aspx#JonHobbs-Smith">Jon</a> for this brilliant idea. Now dealing with different browsers is just a piece of cake!</p><p>Now the only thing I regret of is what took me so long to find out this solution.</p> <img
style='display:none' id="post-256-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://www.phoenixheart.net/2009/04/deal-with-browser-incompliance-using-jquery/',title:'Deal with browser incompliance using jQuery',tweet:'Without a doubt, being a serious web guy you want your new site to look perfect on web browsers. Yes',description:'Without a doubt, being a serious web guy you want your new site to look perfect on web browsers. Yes'})"><script type='text/javascript'>document.getElementById("post-256-blankimage").onload();</script>]]></content:encoded> <wfw:commentRss>http://www.phoenixheart.net/2009/04/deal-with-browser-incompliance-using-jquery/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>php.js &#8211; Javascript equivalents for PHP functions</title><link>http://www.phoenixheart.net/2009/02/phpjs-javascripts-equivalent-for-php-functions/</link> <comments>http://www.phoenixheart.net/2009/02/phpjs-javascripts-equivalent-for-php-functions/#comments</comments> <pubDate>Wed, 11 Feb 2009 15:59:58 +0000</pubDate> <dc:creator>phoenix.heart</dc:creator> <category><![CDATA[Client stuffs]]></category> <category><![CDATA[Featured]]></category> <category><![CDATA[Server stuffs]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[php]]></category><guid
isPermaLink="false">http://www.phoenixheart.net/?p=227</guid> <description><![CDATA[Being a PHP developer, there must be certain times when you have to deal with Javascript. And if you&#8217;re rather confident with PHP when in the meantime suck at JS just like me, you must have more than once googled for the JS equivalent of that very useful/powerful base64_encode, or htmlentities, or array_merge, or strpos, [...]]]></description> <content:encoded><![CDATA[<p><span
class="drop-cap">B</span>eing a PHP developer, there must be certain times when you have to deal with Javascript. And if you&#8217;re rather confident with PHP when in the meantime suck at JS just like me, you must have more than once googled for the JS equivalent of that very useful/powerful <a
href="http://www.php.net/base64_encode">base64_encode</a>, or <a
href="http://www.php.net/htmlentities">htmlentities</a>, or <a
href="http://www.php.net/array_merge">array_merge</a>, or <a
href="http://www.php.net/strpost">strpos</a>, you_name_it.</p><p>Well, I&#8217;m not any exception, until I got acknowledged of a JS project called <a
href="http://phpjs.org/">php.js</a> originally started by <a
href="http://kevin.vanzonneveld.net/techblog/article/phpjs_licensing/">Kevin van Zonneveld</a>. I have used this in more than one of my projects and it just works perfect for me without any hassles, so maybe I should feature it in return. <span
id="more-227"></span></p><p>You can tell, the project is all about porting PHP functions into Javascript. Yes, many of those are there, but under a different name or one step away &#8211; like PHP&#8217;s <a
href="http://www.php.net/sin">sin</a> and JS&#8217; <a
href="http://www.w3schools.com/jsref/jsref_sin.asp">Math.sin</a>. Some others however, are not that easy to obtain in Javascript &#8211; I&#8217;m talking about md5, date, serialize etc. and those array stuffs. It even deals with file system, with the support of the <a
href="http://www.w3.org/TR/XMLHttpRequest/">XMLHttpRequest object</a> (therefore these functions may fail if the browser doesn&#8217;t support it).</p><p>The project is active and it seems Kevin, with the great help from other contributors, is constantly expanding it. A list of available (successfully ported) methods can be found <a
href="http://phpjs.org/functions/index">here</a> &#8211; nearly 300 (!) each with detailed code and examples. You can just copy the function code and embed it into your script to start using right away, or download the full packages for everything.</p><p>I, for myself, can&#8217;t understand how there are such good people in this world: put huge effort into something just to give away, expecting nothing in return.</p><p>Are you using of this wonderful project in your own? If so how about featuring it?</p> <img
style='display:none' id="post-227-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://www.phoenixheart.net/2009/02/phpjs-javascripts-equivalent-for-php-functions/',title:'php.js &#8211; Javascript equivalents for PHP functions',tweet:'Being a PHP developer, there must be certain times when you have to deal with Javascript. And if you',description:'Being a PHP developer, there must be certain times when you have to deal with Javascript. And if you'})"><script type='text/javascript'>document.getElementById("post-227-blankimage").onload();</script>]]></content:encoded> <wfw:commentRss>http://www.phoenixheart.net/2009/02/phpjs-javascripts-equivalent-for-php-functions/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Google Search in an AJAX&#8217;ed way</title><link>http://www.phoenixheart.net/2008/12/google-search-in-an-ajaxed-way/</link> <comments>http://www.phoenixheart.net/2008/12/google-search-in-an-ajaxed-way/#comments</comments> <pubDate>Thu, 25 Dec 2008 08:07:40 +0000</pubDate> <dc:creator>phoenix.heart</dc:creator> <category><![CDATA[Client stuffs]]></category> <category><![CDATA[Featured]]></category> <category><![CDATA[Server stuffs]]></category> <category><![CDATA[ajax]]></category> <category><![CDATA[curl]]></category> <category><![CDATA[google]]></category> <category><![CDATA[jQuery]]></category><guid
isPermaLink="false">http://www.phoenixheart.net/?p=172</guid> <description><![CDATA[I have a good news and a bad news for today. The bad news is, I got hit by a f-king drunker several days ago in a traffic accident (Saigon&#8217;s traffic is pure shit) and had to take some macro surgeries. The good news is, due to this accident I have some free time to [...]]]></description> <content:encoded><![CDATA[<p><span
class="drop-cap">I</span> have a good news and a bad news for today. The bad news is, I got hit by a f-king drunker several days ago in a traffic accident (Saigon&#8217;s traffic is pure shit) and had to take some macro surgeries. The good news is, due to this accident I have some free time to think and do something &#8211; sense and nonsense, just for my habits.</p><p>So yesterday, this pal of mine showed (off) a web project he&#8217;s taking part in &#8211; a site called &#8220;<a
rel="nofollow" href="http://www.heygoo.com">HeyGoo</a>&#8220;. This site uses Google&#8217;s AJAX Search API (and Yahoo&#8217;s too, I&#8217;m not sure) to find and display result in an AJAX&#8217;ed way &#8211; that is, no pagination involved, instead users have to scroll to bottom for the next results to be shown up. Rather interesting, eh?</p><p>Well, my friend he seemed to be very proud of this project and putting all his hope to its success, so I didn&#8217;t want to discourage him. But honestly, I don&#8217;t see it as any revolution. Not talking about the old design with tables everywhere, the annoying target=&#8221;_blank&#8221; anchors and the so-cliché logo, I pointed out for him some problems the site was having:</p><ul><li>The search results are not so good. I searched for something on Google and it returned some hundreds of results, when HeyGoo told me it couldn&#8217;t find any. I don&#8217;t know why, hey, at least it is using Google Search API no?</li><li>There are certainly times that a user want to go to page, say, 3571, to see if his new forum ever reaches to Google. He can do that very easily with any &#8220;normal&#8221; search engine out there, but not with this HeyGoo where he must scroll 3570 times.</li><li>Biggest problem: the site currently doesn&#8217;t care about the loaded results. New results are appended, appended, appended, when old ones are still there in the top. Imagine how much memory the poor browser has to use up for this curious guy who&#8217;s scrolling over 317 pages and counting.</li></ul><p>With all these drawbacks vs. the only ajax advantage (personally I don&#8217;t see it as an advantage but another failure however), I doubt this site will do anything big. Anyhow as a friend I still wish it the best.</p><p>Now to the main part: despite of my skeptical thoughts, I still see the AJAX dynamic scroll content something interesting, and might be useful sometimes. So I sit down and wrote my own (very basic) version of the AJAX Search, where no pagination is involved and you must scroll for something new <img
src='http://www.phoenixheart.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> It took me 30 minutes for the core, and some 30 more for the layout tweaks. Before getting into the code, you can see the final working result <a
href="http://www.phoenixheart.net/projects/ajaxsearch/">here</a>.<span
id="more-172"></span></p><p>It&#8217;s rather simple. The whole &#8220;trick&#8221; was done in 2 part: the client JavaScript, and the server PHP.</p><h3>1. The JavaScript</h3><p>As usual, <a
href="http://www.jquery.com">jQuery</a> is my choice. First, bind to the &#8220;submit&#8221; event of the search form to handle searching.</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td
class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#f&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">submit</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    e.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
    <span style="color: #006600; font-style: italic;">// don't search if there's a search in action, or the form is not valid</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>busy <span style="color: #339933;">||</span> <span style="color: #339933;">!</span>validateForm<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#result&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#loading&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> q <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#q&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// indates that there's a search on the stage</span>
    busy <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// do an ajax call</span>
    $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
        url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;search.php&quot;</span><span style="color: #339933;">,</span>
        data<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#f&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#loading&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;fast&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#result&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;start&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #006600; font-style: italic;">// the start position of result is 0, since this is the first page</span>
                $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;q&quot;</span><span style="color: #339933;">,</span> q<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>      <span style="color: #006600; font-style: italic;">// save the last used keywords</span>
                expired <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>                    <span style="color: #006600; font-style: italic;">// the search has not expired (just started ;))</span>
                busy <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>                       <span style="color: #006600; font-style: italic;">// not busy anymore, ready for the next search</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        error<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#loading&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;fast&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #006600; font-style: italic;">// do something here?</span>
                busy <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>With the <a
href="http://brandonaaron.net/docs/dimensions/">Dimension plugin</a> now natively integrated into jQuery version 1.2.6, it&#8217;s 4 lines of code to detect if the user has scrolled to the bottom of the page and go get the next results.</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td
class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #000066;">scroll</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">scrollTop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> $<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        searchMore<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;</pre></td></tr></table></div><p>Now, the searchMore() function:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
</pre></td><td
class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> searchMore<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// if the site is busy with another search, or if the search has expired</span>
    <span style="color: #006600; font-style: italic;">// (no more results can be found), don't search</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>busy <span style="color: #339933;">||</span> expired<span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// if we don't have a previous search, don't search</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;q&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// i'm working, i'm working...</span>
    busy <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// the start page is increased by 1</span>
    $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;start&quot;</span><span style="color: #339933;">,</span> $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;start&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#loading&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// make another AJAX call</span>
    $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
        url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;search.php&quot;</span><span style="color: #339933;">,</span>
        data<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;q=&quot;</span> <span style="color: #339933;">+</span> $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;q&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&amp;start=&quot;</span> <span style="color: #339933;">+</span> $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;start&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// multiplied by 10</span>
        success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#loading&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;fast&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            	<span style="color: #006600; font-style: italic;">// we have the next result, perfect</span>
            	<span style="color: #006600; font-style: italic;">// append it into the current result</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#result&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                busy <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// not so busy anymore</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        error<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#loading&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;fast&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #006600; font-style: italic;">// do something here?</span>
                busy <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>There, the JavaScript is almost done. Of course there is a &#8220;validateForm()&#8221; function, but I guess it&#8217;s not necessary to include it into this post&#8230;</p><h3>2. The server stuff</h3><p>In order to retrieve the search results from Google, there are at least 2 ways:</p><ol><li>Using its <a
href="http://code.google.com/apis/ajaxsearch/">AJAX API</a>. Unfortunately, for some mysterious reasons, this didn&#8217;t work so well with me, as only 8 first pages can be retrieved. Any attempt to get the remaining results were answered with a 400 bad request error. I guess I missed something, maybe API or ATM <img
src='http://www.phoenixheart.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> but hell with it.</li><li>Making use of the traditional and very powerful cURL. My choice <img
src='http://www.phoenixheart.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></li></ol><p>Here is the entire content of my search.php page.</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.google.com/search?hl=en&amp;q='</span> <span style="color: #339933;">.</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'q'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;start='</span> <span style="color: #339933;">.</span> <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'start'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_REFERER<span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$body</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// do a simple preg_match to get the results</span>
<span style="color: #666666; font-style: italic;">// let's pray that Google won't change its HTML structure for search results so soon ;)</span>
<span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/&lt;ol&gt;(.*?)&lt;/ol&gt;/i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$body</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// no match?</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'start'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;script&gt;expired = true;&lt;/script&gt;&lt;li&gt;No more results were found.&lt;/li&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// set the &quot;expired&quot; JS var to true if this is called from searchMore() function</span>
    <span style="color: #b1b100;">else</span>
        <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;li&gt;Your search did not match any documents.&lt;/li&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Google uses relative path for the image sources and video links on its search pages</span>
<span style="color: #666666; font-style: italic;">// so we turn them into absolute links</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">utf8_encode</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&quot;/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&quot;http://www.google.com/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>That&#8217;s all of the core part. Of course we must prepare the index HTML with all the form, div, ol, img and so on before getting into action, but it&#8217;s not that tricky. So you can visit <a
href="http://www.phoenixheart.net/projects/ajaxsearch/">the result here</a> and do some tests. Remember, this search tool is very basic, and I don&#8217;t have any intention to turn it into anything advanced <img
src='http://www.phoenixheart.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p> <img
style='display:none' id="post-172-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://www.phoenixheart.net/2008/12/google-search-in-an-ajaxed-way/',title:'Google Search in an AJAX&#8217;ed way',tweet:'I have a good news and a bad news for today. The bad news is, I got hit by a f-king drunker several ',description:'I have a good news and a bad news for today. The bad news is, I got hit by a f-king drunker several '})"><script type='text/javascript'>document.getElementById("post-172-blankimage").onload();</script>]]></content:encoded> <wfw:commentRss>http://www.phoenixheart.net/2008/12/google-search-in-an-ajaxed-way/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Bad practices (and how to avoid them) in web development</title><link>http://www.phoenixheart.net/2008/10/bad-practices-and-how-to-avoid-them-in-web-development/</link> <comments>http://www.phoenixheart.net/2008/10/bad-practices-and-how-to-avoid-them-in-web-development/#comments</comments> <pubDate>Thu, 23 Oct 2008 07:40:15 +0000</pubDate> <dc:creator>phoenix.heart</dc:creator> <category><![CDATA[Client stuffs]]></category> <category><![CDATA[Design]]></category> <category><![CDATA[Featured]]></category> <category><![CDATA[css]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[web]]></category><guid
isPermaLink="false">http://www.phoenixheart.net/?p=47</guid> <description><![CDATA[(Yet another post taken from the ruins of Tekaboo) Whether you are a web designer or a server side guy, there are certain times when you must get your hands dirty with HTML codes. Since HTML is rich, and even getting richer with the coming HTML 5, many HTML coders tend to do it improperly [...]]]></description> <content:encoded><![CDATA[<p>(Yet another post taken from the ruins of <a
href="http://tekaboo.com">Tekaboo</a>)</p><p><span
class="drop-cap">W</span>hether you are a web designer or a server side guy, there are certain times when you must get your hands dirty with HTML codes. Since HTML is rich, and even getting richer with the coming <a
href="http://en.wikipedia.org/wiki/HTML_5">HTML 5</a>, many HTML coders tend to do it improperly to achieve what could have done differently (and better). This results in many bad habits that should be avoided.</p><h3>Table designing</h3><p><img
class="shot" title="An internet with tables " src="http://www.phoenixheart.net/wp-content/uploads/2008/10/table.gif" alt="tabletrtd.inter.net" width="478" height="149" /></p><p>No, tables just won’t die (soon), and I’m not insisting them to. They will live happily so long as this internet still has some tabular data to display, or until W3C decides to replace “table” by “chair” which obviously sounds cooler for developers to write.However, for those who are still using tables to align the paragraphs, links, images, and other HTML objects out there, please dust away the cells and begin playing around with CSS design. There are some very good reasons why:</p><ul><li>Codes with table design are almost totally unreadable compared to CSS design</li><li>Tables increase your page’s file size significantly in most cases</li><li>Table design means more work for the browser, especially when you have nested tables (as most of table designers do)</li><li>Finally, regardless of all those conservative heads out there, with all of its advantages, CSS design is the future of the web. Take a look around, now every design job posted on every freelance site includes this line: MUST BE IN CSS AND NOT TABLES, sometimes with 3 or more exclamation marks (!) following.</li></ul><p>So, don’t be easy to yourself. In your next project, begin CSS. Don’t let tables’ “ease of use” prevent you from following the standard. Anyway, who told you that designing using CSS was <em>that </em>difficult to learn?<span
id="more-47"></span></p><h3>Relying on Javascript</h3><p>I bet that you’ve seen this bunch of codes more than once:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td
class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/JavaScript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;!--</span>
<span style="color: #003366; font-weight: bold;">function</span> MM_swapImgRestore<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//v3.0</span>
    <span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">,</span>x<span style="color: #339933;">,</span>a<span style="color: #339933;">=</span>document.<span style="color: #660066;">MM_sr</span><span style="color: #339933;">;</span> <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>a<span style="color: #339933;">&amp;&amp;</span>i<span style="color: #339933;">&lt;</span>a.<span style="color: #660066;">length</span><span style="color: #339933;">&amp;&amp;</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">=</span>a<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span>x.<span style="color: #660066;">oSrc</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> x.<span style="color: #660066;">src</span><span style="color: #339933;">=</span>x.<span style="color: #660066;">oSrc</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> MM_preloadImages<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//v3.0</span>
    <span style="color: #003366; font-weight: bold;">var</span> d<span style="color: #339933;">=</span>document<span style="color: #339933;">;</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>d.<span style="color: #660066;">images</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>d.<span style="color: #660066;">MM_p</span><span style="color: #009900;">&#41;</span> d.<span style="color: #660066;">MM_p</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">,</span>j<span style="color: #339933;">=</span>d.<span style="color: #660066;">MM_p</span>.<span style="color: #660066;">length</span><span style="color: #339933;">,</span>a<span style="color: #339933;">=</span>MM_preloadImages.<span style="color: #660066;">arguments</span><span style="color: #339933;">;</span> <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>a.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> d.<span style="color: #660066;">MM_p</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> Image<span style="color: #339933;">;</span> d.<span style="color: #660066;">MM_p</span><span style="color: #009900;">&#91;</span>j<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">src</span><span style="color: #339933;">=</span>a<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> MM_findObj<span style="color: #009900;">&#40;</span>n<span style="color: #339933;">,</span> d<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//v4.01</span>
  <span style="color: #003366; font-weight: bold;">var</span> p<span style="color: #339933;">,</span>i<span style="color: #339933;">,</span>x<span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>d<span style="color: #009900;">&#41;</span> d<span style="color: #339933;">=</span>document<span style="color: #339933;">;</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>p<span style="color: #339933;">=</span>n.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;?&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">&amp;&amp;</span>parent.<span style="color: #660066;">frames</span>.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    d<span style="color: #339933;">=</span>parent.<span style="color: #660066;">frames</span><span style="color: #009900;">&#91;</span>n.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span>p<span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">document</span><span style="color: #339933;">;</span> n<span style="color: #339933;">=</span>n.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>p<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">=</span>d<span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span>d.<span style="color: #660066;">all</span><span style="color: #009900;">&#41;</span> x<span style="color: #339933;">=</span>d.<span style="color: #660066;">all</span><span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;!</span>x<span style="color: #339933;">&amp;&amp;</span>i<span style="color: #339933;">&lt;</span>d.<span style="color: #660066;">forms</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> x<span style="color: #339933;">=</span>d.<span style="color: #660066;">forms</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;!</span>x<span style="color: #339933;">&amp;&amp;</span>d.<span style="color: #660066;">layers</span><span style="color: #339933;">&amp;&amp;</span>i<span style="color: #339933;">&lt;</span>d.<span style="color: #660066;">layers</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> x<span style="color: #339933;">=</span>MM_findObj<span style="color: #009900;">&#40;</span>n<span style="color: #339933;">,</span>d.<span style="color: #660066;">layers</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">document</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>x <span style="color: #339933;">&amp;&amp;</span> d.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#41;</span> x<span style="color: #339933;">=</span>d.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000066; font-weight: bold;">return</span> x<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> MM_swapImage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//v3.0</span>
  <span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">,</span>j<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>x<span style="color: #339933;">,</span>a<span style="color: #339933;">=</span>MM_swapImage.<span style="color: #660066;">arguments</span><span style="color: #339933;">;</span> document.<span style="color: #660066;">MM_sr</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #339933;">;</span> <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span><span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">length</span><span style="color: #339933;">-</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>i<span style="color: #339933;">+=</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span>
   <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">=</span>MM_findObj<span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>document.<span style="color: #660066;">MM_sr</span><span style="color: #009900;">&#91;</span>j<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>x<span style="color: #339933;">;</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>x.<span style="color: #660066;">oSrc</span><span style="color: #009900;">&#41;</span> x.<span style="color: #660066;">oSrc</span><span style="color: #339933;">=</span>x.<span style="color: #660066;">src</span><span style="color: #339933;">;</span> x.<span style="color: #660066;">src</span><span style="color: #339933;">=</span>a<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">+</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #006600; font-style: italic;">//--&gt;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div><p>Oh, you’ve not seen it ever? Well, I lost my bet… Under the name of a VERY popular HTML editor, these codes are VERY popularly used, for a VERY popular effect that you must have known (this time I bet, really!!!) &#8211; the rollover, or “image-swapping” animation. Basically, there are 2 images involved: one for “normal” state:</p><p><img
title="click_normal" src="http://www.phoenixheart.net/wp-content/uploads/2008/10/click_normal.gif" alt="click_normal Bad practices (and how to avoid them) in web development" width="88" height="25" /></p><p>and the other for “hover” state:</p><p><img
title="click_hover" src="http://www.phoenixheart.net/wp-content/uploads/2008/10/click_hover.gif" alt="click_hover Bad practices (and how to avoid them) in web development" width="88" height="25" /></p><p>When the mouse hovers that gray image, the orange one is shown up, which creates a “lighten up” effect and somehow tells the user: Click me, I’m sexy &amp; ready.</p><p>So what’s wrong with this very cool method, you ask?</p><ul><li>First, the code is huge. See above. And you must implement a “preloading” feature too, or it will take time for the hover-state image to be downloaded and shown up.</li><li>Second, this technique is totally useless if the user disables JavaScript.</li><li>Third, as we have 2 different images here, the number of requests to server is increased.</li><li>And, don’t you know that browser is painfully slow in displaying an image?</li></ul><p>Convinced? Here is the most common solution: Instead of using two images for two different states and make them swap, the HTML experts out there are using just one background image for BOTH states and some attribute of CSS called “<a
href="http://www.w3schools.com/css/pr_background-position.asp">background-position</a>” to create a “rollover” effect that doesn’t hurt. I won’t go into details here, since it will in no doubt lengthen this article unnecessarily, but I have <a
href="http://www.findmotive.com/2006/10/31/simple-css-image-rollover/">a good resource</a> for you. Using this very simple technique, all the disadvantages listed above will just vanish.</p><p>With all this blahblah, however, I’m not stressing on a rollover effect alone. What I’m trying to tell is that sometimes you just don’t have to Javascript at all. We know that not everything can be done in CSS instead of Javascript, as JS has undeniable pros. But keep in mind that pros come with cons, and whenever you can, avoid it.</p><h3>Overusing images</h3><p><img
class="shot" title="Too many images!!!" src="http://www.phoenixheart.net/wp-content/uploads/2008/10/toomuch.jpg" alt="Too many images!!!" width="288" height="203" /></p><p>I know, “A picture speaks a thousand words” as they say. What a pity that doesn’t apply in web designing &#8211; if the term “picture” implies an “text displayed as image”. Following the innovation of Web 2.0 where only content matters, images are being reduced from websites, and yes they have good reasons to do so:</p><ul><li>Images weigh. A small image can easily weigh ~10KB, that is (how coincident) ~1000 words. If you have a busy site, that image can easily cost you gigabytes of bandwidth each month. It’s money. So how to save some of that bandwidth/money? Use some meaningful texts instead. How about replacing that fancy button with the “Click me” text now?</li><li>Those are fat, slow. Images are not an exception. A site loaded with images will load v……e….r…….y s…..l….o……..w…….l…..y. And <a
href="http://www.akamai.com/html/about/press/releases/2006/press_110606.html">researches have shown</a> that 4 seconds is the maximum loading time a web surfer accepts (<a
href="http://www.websiteoptimization.com/speed/1/">some</a> say that it’s 8 sec anyway). Then, if your page takes more than ten seconds to load, unless it has some real pictures about aliens on Mars, users will leave. So, following Mc Donald’s rule: if you want your visitors to stay, don’t make them wait.</li><li>Images are very bad in term of accessibility. Web visitors with limited seeing ability tend to use the built-in “Text Size” tool available in almost all browsers to increase or decrease the size of text, thus can have a better reading experience. With images, they simply can’t. Very bad, I must repeat.</li><li>Pages with images all over the place suck in printing. When the acceptable print resolution is 300dpi, normal web image resolution is only 72 dpi or so. This results in a terrible print quality.</li></ul><p>With all these proofs (and maybe more that I’ve not come up with), along with the fact that 90% of images on your page are totally replaceable by plain text, let there be text!</p><h3>Everything is &lt;p&gt;</h3><p>More than often I encounter websites in which every text content is contained in &lt;p&gt;…&lt;/p&gt; tag pairs, where the titles and headers &lt;p&gt;’s are formatted to be bold, with bigger size, underlines etc. to differentiate from other normal &lt;p&gt; elements.</p><p><img
class="shot" title="Header and paragraph" src="http://www.phoenixheart.net/wp-content/uploads/2008/10/p.gif" alt="Header and paragraph" width="474" height="141" /></p><p>It is a misuse of &lt;p&gt;.</p><p>&lt;p&gt; is intended to display paragraph content, while heading tags like &lt;h1&gt;, &lt;h2&gt;, &lt;h3&gt; etc. are for heading and title texts. Though you can always use CSS to make a specified &lt;p&gt; to stand out of the crowd to be an article title, and it seems to make no difference or problem in displaying or accessibility or readability or whatsoever, it’s perfectly wrong. According to Wikipedia, &lt;h&gt; tags have something to do with “the document’s structure and organization” and “some programs use them to generate outlines and tables of contents”. So, to human eyes, your page may look like a document, but with cyber programs, it may not. Talking about <abbr
title="Search Engine Optimization">SEO</abbr> this misuse will likely result in a low rank in Google.</p><p>So here’s the final line: let &lt;p&gt; be &lt;p&gt;. There’s no special &lt;p&gt; in this web development world, please.</p><h3>“Look what I can do” style</h3><p>(I must admit, this is the bad habit I’m trying to give up too). <img
class="shot" style="margin: 5px; float: right;" title="Please wait while I'm fading in" src="http://www.phoenixheart.net/wp-content/uploads/2008/10/wait.gif" alt="Please wait while I'm fading in" width="297" height="373" /></p><p>Thanks to the open source wave in web development, now creating cool user experiences is easier than ever. Back in the old days, a drop-down menu was a breathtaking effect, and you attracted user attention by making the text blink. Now, it’s a massive number of killing javascript stuffs out there: slide up down right left, fading in and out, shaking, scaling, folding, bouncing, exploding, fish eye, light box, drag and drop… each with one or two lines of code. And you don’t have to care about cross browser compatibility, as they (jQuery, mootools, script.aculo.us, Dojo) have done that already for you. Web developers, we’re at your service!</p><p>Ok, wait…</p><p>Since effects are all cool, you may want to show them off. “Look this, and this, and this, hey, impressed?” that’s how your website is saying. But (I hate this word, <em>but</em> I have to use it yet again), beware, those fancy stuffs may be something that make your site not accessible. Like, a user may have to click on a link and wait for the invisible div to slowly fade in just to read its content. Isn’t it something tiring? Why must the content be one click (and five seconds) away from him? Why wasn’t it there from the beginning?</p><p>Unless you have a very good reason to, don’t ever hide your content from the users. Sure, fading divs are candies for the eyes, but a rushing user’s eyes don’t need any candy. By the way may I ask who’s not rushing today?</p><h3>What else?</h3><p>Actually I had something more in mind before starting this articles, such as “Click me” linking, frame structure, Ajax overuse etc., during writing I got a feeling that those are too much into details, so I decided to omit them. Maybe I will put them back into the table (not <em>that</em> table) in the near future.</p> <img
style='display:none' id="post-47-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://www.phoenixheart.net/2008/10/bad-practices-and-how-to-avoid-them-in-web-development/',title:'Bad practices (and how to avoid them) in web development',tweet:'(Yet another post taken from the ruins of Tekaboo) Whether you are a web designer or a server side g',description:'(Yet another post taken from the ruins of Tekaboo) Whether you are a web designer or a server side g'})"><script type='text/javascript'>document.getElementById("post-47-blankimage").onload();</script>]]></content:encoded> <wfw:commentRss>http://www.phoenixheart.net/2008/10/bad-practices-and-how-to-avoid-them-in-web-development/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Things I hate on a web page</title><link>http://www.phoenixheart.net/2008/10/things-i-hate-on-a-web-page/</link> <comments>http://www.phoenixheart.net/2008/10/things-i-hate-on-a-web-page/#comments</comments> <pubDate>Wed, 22 Oct 2008 14:12:30 +0000</pubDate> <dc:creator>phoenix.heart</dc:creator> <category><![CDATA[Blahblahblah]]></category> <category><![CDATA[Client stuffs]]></category> <category><![CDATA[Featured]]></category> <category><![CDATA[annoyances]]></category> <category><![CDATA[web]]></category><guid
isPermaLink="false">http://www.phoenixheart.net/?p=12</guid> <description><![CDATA[(This is one of my article from Tekaboo) I’m a die-hard web surfer. Internet takes me at least 7-8 hours a day. I read almost everything web: tech and non-tech news, wiki, Google, mythology, game reviews, forum discussion, manga, even pr0n sexy content. After years of web surfing, I’ve come up with a list of [...]]]></description> <content:encoded><![CDATA[<p><em>(This is one of my article from <a
href="http://tekaboo.com">Tekaboo</a>)</em></p><p><span
class="drop-cap">I</span>’m a die-hard web surfer. Internet takes me at least 7-8 hours a day. I read almost everything web: tech and non-tech news, wiki, Google, mythology, game reviews, forum discussion, manga, even <span
style="text-decoration: line-through;">pr0n</span> sexy content. After years of web surfing, I’ve come up with a list of things that I really, really HATE to see on a web page. I would almost close the page right away or never come back again if the site I attempt to visit:</p><h3>1. Disables right clicking and/or text selecting</h3><p>These are certainly on top of the most stupid Javascript techniques have been “invented”. It’s still a mystery to me why should one need to prevent right clicking on his site, and how effective such a method can be. Right, if you don’t want your precious text and pictures to be copied (read: shared), why bother posting them up? Just keep them to yourself, Mr Ego. Don’t you know that Javascript can be disabled in every browser? Lame.</p><h3>2. Underlines those non-link texts</h3><p>Yes, you may call me a picky old man, but believe me, it sucks to click on that underlined text and realize that it’s not a hyperlink at all. It’s almost a standard to reserve underlining for links, and this move against standards is not acceptable (at least, by me).</p><h3>3. Opens links in a new tab</h3><p>Or worse, in a new window &#8211; yes, even in tabbed browsers. Whenever I click on a link and it pops up a new tab, I go “WTF?” Hey, haven’t I no choice? If I want another tab, I can hold down my Control key and click (or simply middle-click, depending on the mood). There’s no point in trying to act smart reading my mind! And what is it for, that new non-resizable window? Thanks, but no thanks.<br
/> <span
id="more-12"></span></p><h3>4. Plays the clock</h3><p>More than often I see this text on the web pages: “The time is now 3:26:43PM, Tuesday, October, 07, 2008″. And it’s flickering with each tick. Heck, don’t they have some better news to show? I have a watch on my left wrist, a big rounded clock hanging on the wall before my eyes, another on the bottom-right corner of my desktop, yet another on my iPhone’s waiting screen. Do I need another clock? If you don’t have anything interesting to show off, just leave that space blank please.</p><h3>5. Plays sound on background</h3><p>This usually happens with teenagers’ blogs, and is one of the main reason I rarely visit them. Okay, totally agreed, that song is sweet and it fits your (mournful) mood. But goddammit, it’s 1:27AM here, you know? How cool is it to hear someone groaning at midnight? And where, for God’s sake, where is the Stop button?!? Help!</p><h3>6. Has banner ads that won’t stay put</h3><p>Many (or all) sites have banner ads, as they are the main income. It’s totally understandable. I don’t hate ads, really, and don’t use Adblock Plus’ “Adblock images…” feature very often. But there is one exception: those fancy sliding banners. Holy cow. I scroll down &#8211; they go down, I scroll up &#8211; they follow up. And flickering. And flashing, boom boom. Why don’t you let go of me? Leave me be!</p><h3>7. Has marquees running across my screen</h3><p>Similar are the marquees, the shameful ruins from 90s that you may still encounter on some sites about financial, forex, and (especially) weather. Thanks for the forecasting, wow, it’s cool, tomorrow is going to be hot in Ho Chi Minh city, 32 degrees in the morning, and raised up to 3… hey, don’t run away! STOP!</p><h3>8. Only displays content on hovering</h3><p>I’m pretty sure you’ve seen them: those sites that won’t display content upon loading. Only until you hover the mouse over the link, poop, a small div pops out with some text contained. Is it annoying? Yyyes! Hola webmaster Sir, I visit your site for the content, so would you mind showing it out from the beginning?</p><h3>9. Has its content being nothing but a BIG Flash file</h3><p>Sure, Flash is still one of the best innovations ever seen in internet. And seems like people are overusing it a bit… or two. Despite of all those rocking animations, I still miss my browser’s context menu… and the ability to select and copy texts… and the back button… and the read-while-loading content… and my iPhone’s browser… If your site is nothing but Flash, please make sure that an alternative HTML version is there, or you will lose 2 visitors: me (who?) and Google (WHO???).</p><h3>10. Doesn’t provide an RSS feed</h3><p>There were times when I happened to visit a site whose owner was a humorous guy and contents were very interesting, something like a how-to-squeeze-milk-from-a-bull article or so. Naturally I wanted to be kept informed about his next how-to’s, so I took a look at the top-right corner for that orange icon. It wasn’t there. “Of course, he may want to put it at the bottom” I thought. But again I was wrong. The RSS link was nowhere to be found. It simply means that the cool site didn’t provide any feed. It pissed me up. Is implementing a feed that hard? Isn’t it just an XML file which any XML writer out there can do? Bye.</p><h3>11. Doesn’t offer a search box</h3><p>As far as I get, searching has become the top-most action of web users, who use Google <a
href="http://www.mathewingram.com/work/2008/09/05/how-many-searches-has-google-done/">about 2 billion times a day</a>. So unless you want to keep your site a mysterious castle looking, please give me a search box. If it’s a feature that’s out of your ability, you can always <a
href="https://www.google.com/adsense">leave it to Google</a>.</p><h3>12. Opens my Outlook composing window when I click on that “Contact Us” link</h3><p>Today, internet business is <em>real</em> (take a look at Google!), and real business means real customers. Guess I don’t have to stress how important customer relationship is. So it shocks me everytime I click on a “Contact Us” link just to see an Outlook’s New Message window pop up. Shame on you, how lazy you are, the site owners! Will it take you millions or years to add a <em>real</em> contact form?</p><h3>13. Goes back to home page when I switch language</h3><p>I’m always happy to see a page with multilingual support (one of the best is definitely Wikipedia). It beats me however, if the language switcher brings me back home. No, I don’t want to find my way through the chaos to that great post again, I want the page to stay the same, with only the language changed to my needs!</p><h3>14. Makes me install additional software(s)</h3><p>Just like everyone else (well, may not be including you), I’m a lazy web visitor that wants everything to be already prepared. “Silverlight is required before viewing this content”? Fine, I quit. “To play this media you need Quick Time installed”? Nevermind, goodbye. “Please update your Real Media plugin in order to hear the song”? No, I hate to restart my machine.</p><h3>15. Has a m.arvello.us domain name</h3><p>How many times have you heard of a abc.def.us domain name, following del.icio.us? Or that “er-without-e” trying to be Flickr? For the first time, it sounds brilliant. For the second time, not very creative but still OK. From the third time on, it’s lame. Really lame. I can’t expect a site to have interesting contents when its name is just a parrot. Script.aculo.us is an exception, but still jQuery is my winner.</p><h3>16. Makes me “wait while redirecting”</h3><p>“Welcome back! Please wait while we’re redirecting you.” is a common message that can be seen in almost every forum. The question is, why must I wait? Why don’t you take me directly to the page I want? I know, there’s always a direct link, but what’s the purpose behind that waiting time? More than once, I view the source code of the page (HTML and PHP alike) but it shows me no light &#8211; there’s absolutely no running process in the background that can give that “Please wait” message any sense. So, I decided that it’s just an old nonsense habit that needs to be buried for good.</p><h3>17. And some more</h3><p>I also dislike sites that have a “designed by ThisVeryProudCompany” bottom line, or pop up a Javascript message box (alert!) instead of HTML messages, or have CAPCHA’s all over the place etc. Call me picky then, but it’s hard to change someone’s mind…</p> <img
style='display:none' id="post-12-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://www.phoenixheart.net/2008/10/things-i-hate-on-a-web-page/',title:'Things I hate on a web page',tweet:'(This is one of my article from Tekaboo) I’m a die-hard web surfer. Internet takes me at least 7-8',description:'(This is one of my article from Tekaboo) I’m a die-hard web surfer. Internet takes me at least 7-8'})"><script type='text/javascript'>document.getElementById("post-12-blankimage").onload();</script>]]></content:encoded> <wfw:commentRss>http://www.phoenixheart.net/2008/10/things-i-hate-on-a-web-page/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching 3/11 queries in 0.021 seconds using disk

Served from: www.phoenixheart.net @ 2010-09-09 07:58:32 -->