Too Cool for Internet Explorer

The most AJAX frameworks are bloated with many functions you’ll never use or need. Who wants 60 KB of JavaScript if your only need is to send and load data? I Don’t.

I have found somewhere a short howto for AJAX, and derived (rewritten) the smallest AJAX framework ever out of it:

Read the rest of this entry »

If you search for a solution to get the age of a person (in years) in MySQL, google gives you many obsolete (and complicated) answers, from MySQL 4.1.1 it is very easy to get this number:

TIMESTAMPDIFF(YEAR, myDateColumn, NOW())

Have fun.

When you create a div layer with 100% width and height, the height is always only the height of the browser window, not of the page content (which can be much higher).

To solve this, give the layer div an id and use the following JS code inside the layer div:

<script type="text/javascript">document.getElementById("yourlayerid").style.height = document.getElementsByTagName("body")[0].offsetHeight + "px";</script>

The code is very simple, it gets the height of the content (the body element) and gives it the layer div.

Tested in Opera, Firefox and *barf* MSIE (8).

Nearly every browser will show image oder video files you want to provide for download in the browser itself instead of opening a download dialog.

Most of the websites suggest to use this code in your .htaccess:

<FilesMatch "\.(jpg|zip|avi)$" >
	ForceType application/octet-stream
</FilesMatch>

But this is not enough! Even when the MIME-Type is set to “octet-stream”, some browsers will still open the files their selfs because they have detected the .jpg or .avi file extension.

The solution to this is to add the following header:

<FilesMatch "\.(jpg|zip|avi)$" >
	ForceType application/octet-stream
	Header add Content-Disposition "attachment"
</FilesMatch>

With this header every browser i tested opened a download dialog, regardless of which file extension is present.