Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove cross domain dependency #19

Merged
merged 1 commit into from May 4, 2014
Merged

Conversation

ccampbell
Copy link
Contributor

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.

Do not try to load the current favicon before updating it
@ccampbell
Copy link
Contributor Author

Probably best to look at the diff with whitespace changes off

ccampbell@60b4405?w=1

@lipka lipka merged commit 60b4405 into lipka:master May 4, 2014
@lipka
Copy link
Owner

lipka commented May 4, 2014

@ccampbell You're absolutely right. Good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants