Of course I have a backup!

Random blobs of wisdom about software development

Developing a browser extension

Tuesday, May 14, 2013

Ever wondered how you can develop a browser extension? It's not hard, you just have to read a bit of docs, and do a lot of trial and error. This will be a 3-5 posts long series, that talks about how to develop an extension for today's browsers in general, and the various traps one might fall into while developing one. I am covering Chrome, Safari, and Firefox in detail, unfortunately I have no experience with IE, and Opera. I will also talk about cross-browser extension frameworks at the end.

(Continued)

Tagged as: | Comments (0)

Common JavaScript patterns: Event delegation

Monday, October 31, 2011

I see these types of questions a lot on forums:

I have made an ajax based favorites system on my webshop. Users can click on the "add" button next to each product, and it will be added to their favorites list. Everything works fine, except that on freshly favorited elements, the "remove" button does not work, until I refresh the page. What could cause this? Here is the code. I'm using jQuery.

Without even taking a look at the code, I already know what the problem is. The problem usually has nothing to do with jQuery, but given the popularity of it, but it usually gets associated to it. The question can come in various flavors, but the pattern is always the same:

There is a container element, that has elements added to it via DOM manipulation, and the newly added elements behave in unexpected ways, usually some functionality is not working, until a page refresh is made.

(Continued)

Tagged as: | Comments (0)