IE Download Over SSL Error

Previous Code

header(‘Content-type: application/pdf’);
header(‘Content-Disposition: attachment; filename=”downloaded.pdf”‘);

New Code

header(‘Cache-Control: maxage=3600’); //Adjust maxage appropriately
header(‘Pragma: public’);
header(‘Content-type: application/pdf’);
header(‘Content-Disposition: attachment; filename=”downloaded.pdf”‘);


jQuery Mega Menu & Cycle

Recently I have problem putting mega menu into existing page which previously use sothink dhtml menu. This page already have image slideshow using jQuery cycle. Unfortunately when I add mega menu, the image slideshow become frozen. After pulling my hairs for few minutes, the workaround is quite easy, just open jkmegamenu.js and comment the first line

// jQuery.noConflict();

that’s it, works like a charm…

31 Useful Firefox Plugins for Web Developer

Update: I’ve packed all these extension into one XPI file for fast install, you can download it from:

  1. 4Shared
  2. Rapidshare
  3. Mediafire

File Hosting List

Recently I have a need to upload some files to many free file hosting so I did a search on Google, and this is part of the result.

Dynamic form elements and Internet Explorer 6

A few brief entries from the ‘tiny yet annoying bugs that take far too much time to fix’ file…

I’m creating forms dynamically using JavaScript. This has led to a number of problems with IE6:

Dynamic checkboxes/radio buttons and the ‘checked’ attribute

When creating a field, I wanted to be able to apply a ‘default’ value — for example, a checkbox element might be ticked by default. This was all going smoothly until (guess what?) I tested it on IE6: the checked attribute was set, and returned ‘true’ when tested, but the box did not appear to be checked when it appeared in the form.

The answer, as I discovered thanks to this forum post, was to use the ‘defaultChecked’ attribute instead (I set both, just in case). It seems to work across browsers, which is nice. Oh, and this applies to radio buttons as well as checkboxes.

Creating radio buttons

While we’re on the subject of radio buttons, I also found that IE6 doesn’t like radio buttons created using document.createElement() (i.e. as a DOM object). It’ll render them OK, but they’re unclickable. The answer is to create them by injecting HTML into an element with [element].innerHTML:

var obj = document.createElement( ’span’ );
obj.innerHTML = ‘<input type=”radio” name=”somefield” value=1>1′;

…and so forth. Ugly.

Assigning values to multiple select elements

This was a really fiddly one, and seems to happen under only very particular circumstances. Anyway…

If you create a select element and set the ‘multiple’ attribute, IE6 can sometimes have trouble assigning values to it if you do it immediately after it’s created. Note the word ’sometimes’: I haven’t been able to create a simple enough test case to isolate the exact circumstances that are required. And it’s only a problem if you’re setting more than one value.

Anyway, the (horrible) fix is to delay setting the values using setTimeout(). The delay doesn’t matter (1 millisecond will do), but it does work.

I hope these notes help some other unfortunate soul out there avoid wasting the number of hours and brain cells that I just have!