A notch above a monkey

Zemanta

Yesterday was my last working day at my current job . I will start working at Zemanta next Friday, where I will take over from Jure as a head of front-end development. I really admire what Jure and his team have done so far and it will be a real challenge to keep up with his tempo. I’m also looking forward to solving problems that will make our extension, which I’m sure you already have, even more friendly and useful. Hopefully some of those problems will result in content on this blog that is worth reading.

In the meantime I have few days of vacation that will hopefully be spent on resting and cleaning up various tasks that pilled up in last few months.

Triggering a server request on onunload event

A while ago I tried to trigger an AJAX call to server in onunload handler and failed miserably. It simply didn’t work in major browsers and I filled the idea under can’t-be-done.

I recently got another reason to revisit this problem and came up with a new-old idea. Since in my case I don’t care about server response, I don’t actually need XMLHttpRequest. Any technique that triggers a call to server is good enough, so why not try creating an image and setting its url attribute to appropriate value.

It turns out that this works almost everywhere. It worked pretty flawlessly in Firefox, Opera and Internet Explorer, but it doesn’t work in Safari and Konqueror, which makes me think that KHTML/Webkit family of browsers in general don’t support it.

This is not its only limitation. Technique obviously works only for GET calls, which is frowned upon and generally dangerous for actions that change state. I also suspect it works less well on slower computers or networks so you might need to delay event handler ending by buying some time with needless processing after you’ve set url attribute.

Still, it might be another useful hack to have if you can live with its limitations.

Javascript events - drugi??

Moje predavanje o Javascript events, ki je odpadlo pred dvema tednoma, bo na sporedu danes. Isti kraj in ??as — ob 19h v Kiberpipi.

Bralcem se opravi??ujem za pozno sporo??ilo, ki vsaj upam vseeno ni prepozno.