How to add specific style/script for IE in HTML?

There are times when we want a specific style or stylesheet or a javascript to be rendered only in IE and not other browsers such as FireFox. If this is so, then you can do so by adding following if and endif declarations in the HTML. Insert the style or stylesheet or javascript that needs to be rendered only by IE between the if and endif declarations in the HTML.

<!- -[if IE]>

Style or Stylesheet or JavaScript that should be rendered by Internet Explorer (IE) only will come here.

<![endif]- ->

Flash Detection JavaScript

Websites that use flash must use flash detection JavaScript. Such a JavaScript will look for flash player on the user’s browser. If it detects no flash player, it will display an alternative image instead of the flash. This makes your web page user-friendly for all those visitors who do not have flash player installed. For me, it’s a must for all web pages that use flash. For reference you might want to look at how I used flash detectionJavaScript on the home page for DagadTrikon.com. The only drawback is that it wouldn’t work when JavaScript is disabled.

Here are the JavaScript files you will need. I didn’t write these scripts but got it while I was working at ECommerce Partners. Hence, I have no clue who to credit for this. Continue reading Flash Detection JavaScript

Check Web Page Download Time

One of the principles of usability is fast downloading of a web page. Here’s a neat tool that helps to check web page download time. This will help your website from search engine optimization perspective as well.

Tips for reducing download time for a web page:

  • Use div’s rather than tables for layout.
  • Use XHTML rather than HTML.
  • Separate content from presentation completely by using external StyleSheet.
  • Do not add inline styles or scripts. All JavaScript should be in external file.
  • Optimize the size of images. Make sure that you use GIF images or JPEG images appropriately depending upon the file size and required resolution.
  • Keep the length of the page not too long. This will help reduce the size of the page and is user-friendly as the visitor doesn’t have to scroll too much.
  • Optimize the size of all multimedia files such as video, audio and flash.
  • Do not use frames.
  • Make sure your hosting server can provide required bandwidth for your website.
  • Note that adding advertisements on your web page usually increases the download time.

Min-Height

Majority of the web page layout require side navigation column and the content column to expand vertically equal. This can be a challenge when we prefer to use div rather than tables for layout.

I explained one of the most useful hacks that create an appearance of two columnar div’s expanding vertically equal to each other. However, there are times when we actually want both the columns to have equal height. The solution can be min-height – a very helpful CSS property. However, it doesn’t work in IE. It works in FireFox. Continue reading Min-Height