Skip to main content

Posts

Showing posts from April, 2009

jQuery: When does a library become a language?

jQuery is a great JavaScript library which allows web developers to write cross platform code, but some of its syntax looks like it is based more on Ruby than JavaScript. When does a library become a language? So first of all, what is the difference betwen a programming library and a programming language? A programming language is a means by which we (as humans) can give instructions to a computer to get it to do various tasks (algorithms, computations, etc...). They are largely artificial constructs created for human readability which then need to be compiled or interpreted into actual instructions which the computer can then carry out. A compiler turns a program into machine readable instructions ahead of time (compile time) where as an interpreter does so on the fly (runtime). Languages such as C and Java are generally compiled and JavaScript, Perl and Ruby are generally interpreted. While there is no real reason why this has to be the case, these factors normally affect the syntax

IE6 Update

Calling all web developers. The folks over at this site have done something wonderful. http://ie6update.com/ Basically, you include this code on your site, and all IE6 users see a drop down bar which looks like an ActiveX update and links to download IE8. This is such a brilliant idea. If MicroSoft won't force people to upgrade, then we, as a community, should.

CSS Hacks = Lying

There are many similarities between using CSS hacks and lying. First of all, what is a CSS hack? A CSS hack is a means by which you can get different browsers and browser versions to see and render your stylesheets differently so you can give them different directions (ironically though it's normally done to achieve pixel perfect cross platform web pages). They are also mostly done for Internet Explorer (which for some reason refused to implement standards based CSS until recently). CSS hacks mostly exploit bugs in a particular browser such as the Star HTML hack . This hack was used to get code to run in IE6 and lower in a different manner than other browsers. IE also introduced conditional comments which allow you to add an extra stylesheet to "fix" any CSS issues. This is not technically a hack, but it does require you to write and maintain extra CSS. There are also more subtle types of hacks to make up for some things that are missing in IE like the IE min-height hack

Getting Search Engines to read Flash Content

Ok, so I lied. While Google supposedly now does index Flash content, what this article is really about is a quick a dirty way to get search engines to index your pages which contain Flash without having to display that content to the user in the HTML. Basically this technique relies on swfobject ( http://code.google.com/p/swfobject/ ). One thing swfobject does in dynamic mode is allows you to specify alternative content in a div for non flash users which gets switched out via JavaScript once the page loads: <script type="text/javascript"> swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0"); </script> <div id="myContent"> <p>Alternative content</p> </div> So basically you can duplicate the content which goes into the Flash app in the Alternative content section. Search engine spiders index HTML, but don't run JavaScript so are none t