If you are using pinify‘s createThumbbarButtons function, and you got stuck finding ways to make it work. Then this article is for you. I’m dealing with jQuery pinify version 1.2 here.
First of all, they did a great job with pinify – it makes life easier for web developers who want or who are required to make use if IE9′s browser pinning feature. My task was to implement thumbnail preview controls in one of the sites I’m working on.
After diligently following the documentation and pinify’s example, I found myself stuck in getting it to work. Until I finally decided to dissect jquery.pinify.js. I looked for the createThumbbarButtons function and I found it with a try/catch statement. With catch statement left empty, I inserted console.log(‘createThumbbarButtons error: ‘ + e.description); under the catch(e) declaration. It ended up spitting a “Object doesn’t support property or method ‘addEventListener’” error.
Stupid IE as usual, it’s having problems with addEventListener. This error is caused by document.addEventListener(‘msthumbnailclick’, clickCurrent, false); which is only found within the createThumbbarButtons function. The solution is to replace the addEventListener statement with a good old jQuery bind:
Update: Okay, the correct solution for this is to add the following tag within your head tag:
This will force the browser to use IE9 compatibility mode if it is available. And this will recognize addEventListener without any errors.
Finally it worked. =)