RSS2.0

I moved to Debiprasad.net. Now I am blogging there, so please visit Debiprasad.net and keep me reading. love, Debiprasad

Ask questions related to online shopping in India

Where to buy online in India?

wheretobuyonline.in

I became Top 250 affiliates of Spread Firefox (SFX)

Today is a great day for me, as I became Top 250 affiliates of Spread Firefox (SFX). Today my rank is 233 with 30 downloads in last 7 days and 32 downloads in total.



And a request as well as an advice, if you are using Internet Explorer, then please download Mozilla Firefox and enjoy best browsing ever. Firefox 3

I became Top 250 affiliates of Spread Firefox (SFX)SocialTwist Tell-a-Friend TwitThis

Use Conditional Comments for Internet Explorer Specific Code

If you want to display some content in any web page, specific for internet explorer or other than it, you can do it at least 3 ways.

  1. Using your server sided script
  2. Using JavaScript or any other browser sided script
  3. Conditional Comments
Now I am going to discuss about Conditional Comments. Conditional comment is some simple html code, if the condition satisfies, then the code between the start point and end point of the conditionals comments displays in the browser else treated as comment.

The following example shows the contents inside the conditional comments if the browser is Internet Explorer. For other browsers it will be treated as comment only.


If you want to run some code in the browsers other than Internet Explorer, the follow the following syntax.


Note: Here there is no -- before ! symbol at start of the tag and -- in end tag. This is called as Conditional comments revealed, which will be parsed by other browsers, but will be evaluated by the IE. If the condition satisfies, then IE will treat it as comments, else parse the code in between.

Now if you want to run some code in version specific Internet Explorer, then follow the syntax bellow.



Why to use conditional comments to detect browser?
It has two benefits. First one is it doesn't require server sided scripting, static websites can use it effectively. Second one is, you also don't need any client sided scripting.

Reference:
MSDN - Detecting Internet Explorer More Effectively

To learn more about conditional comments please read: MSDN - About Conditional Comments

And if you are using Internet Explorer, please download Mozilla Firefox 3 to experience the best browsing ever. Firefox 3

Use Conditional Comments for Internet Explorer Specific CodeSocialTwist Tell-a-Friend TwitThis

My Shared Items in Google Reader

My Blogroll

Followers

Want to see/show anything here? Contact me :)