lipka/piecon — pull request #19 by ccampbell (2014-04-14 16:57:59+00:00)
Title: Remove cross domain dependency

We just ran into this issue at @vimeo. We load our favicon off of a cdn.

The source is http://f.vimeocdn.com/images_v6/favicon_32.ico

We noticed we were getting a bunch of CORS errors because we do not have access control headers set up for this cdn domain. I was going to add them, but then it occured to me that they shouldn't be needed.

Unless I'm missing something, it looks to me like each time you call to update the favicon to a specific percentage you first create a new Image() with the source of the currentFavicon and wait for it to load. This is a lot of extra requests that are not necessary to just write a data uri out to the page, but it also means that it won't work if your favicon is hosted on a separate domain.

You can reproduce the issue by setting the source on your example/index.html page to the url I provided.

This pull request removes all the image preloading so it should also cut down on requests and speed things up.