Fixed Error in console when favicon is present


Active member
Affected version

I noticed I am seeing the following error in Chrome's console when browsing my forum: "Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported"

I've tracked this down to the function faviconDraw in core.js

Is it because my favicon is in .ICO format? Not sure, I don't see the error here on XF but I see you are using a PNG. I'd like to keep the the favicon as ICO since I can pack multiple sizes in it - with PNG scaling occurs in some browsers which ends up making the icon look blurry.

Favicon code:

<link type="image/x-icon" rel="shortcut icon" href="" />

Chris D

XenForo developer
Staff member
I wasn't able to reproduce this issue with any icon but your own. I'm not sure if that could be something to do with how it's made or whether there are some security policies on the server, but it doesn't appear to be a general issue.

That said, we've made changes to catch this. Ultimately it just means the little red dot won't appear over the icon, and the error is just silently suppressed.

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.3).

Change log:
Suppress a browser console error if the canvas operations to draw over a favicon image fail.
Any changes made as a result of this issue being resolved may not be rolled out here until later.