How To Create an IE-Only Stylesheet

The tool of choice for fighting IE problems is the conditional stylesheet. IE provides comment tags, supported all the way up to the current IE 8 to target specific versions, as well as greater-than/less-than stuff for targeting multiple versions at once.

Why use conditional stylesheets?

1.    Create a stylesheet and javascript common for all browser, without using any hacks to work around rendering problems in MSIE
2.    Create a stylesheet and javascripts common for all versions of MSIE.
3.    Create a separate stylesheet and javascripts for each of the MSIE versions you want to target.
4.    Include the stylesheets and javascripts from 2 and 3 by using conditional comments.

One good example can be found at http://www.gpuri.com

Inject Google analytics code in HTML pages

To update your HTML/JSP/PHP pages with the google analytics you can
use UNIX sed command and inject the two scripts provided for your
website by google analytics. Below is the code. This code replaces
</body> tag with the scripts and </body> tag.

find ./ -type f -iname “*.htm” | xargs sed -i ’s/<\/body>/<script
type=\”text\/javascript\”> var gaJsHost = \(\(”https:” ==
document.location.protocol\) ? “https:\/\/ssl.” : “http:\/\/www.”\);
document.write\(unescape\(”%3Cscript src=’\”” + gaJsHost +
“google-analytics.com\/ga.js’\” type=’\”text\/javascript
‘\”%3E%3C\/script%3E”\)\);
 <\/script><script type=”text\/javascript”> try { var pageTracker
 = _gat._getTracker\(”UA-XXXXXXX-X”\); pageTracker._trackPageview\(\);
 } catch\(err\) {}<\/script> <\/body>/g’