Permalink
Browse files

fixed dynamic favicon

  • Loading branch information...
Ames committed Apr 6, 2011
1 parent 52e02e1 commit 9a31de3918b21ac73b5b1c8e5f2ecdce25d4cedb
Showing with 16 additions and 9 deletions.
  1. +15 −9 favGen.js
  2. +1 −0 index.html
View
@@ -20,19 +20,25 @@ var setFavCol=function(col,notify){
ctx.fill();
- //var head=document.getElementsByTagName('head')[0];
- var head=document.getElementsByTagName('body')[0];
+ var head=document.getElementsByTagName('head')[0];
+ //var head=document.getElementsByTagName('body')[0];
if(!favLink){
favLink=document.createElement('link');
favLink.rel='icon';
- }else{
- head.removeChild(favLink);
+ favLink.type = "image/png"; //this fixed it.
+ head.appendChild(favLink);
}
+
+ favLink.href = canvas.toDataURL('image/png');
+ }
+}
+
+var removeFav=function(){
+ var head=document.getElementsByTagName('head')[0];
+
+ head.removeChild(favLink);
+ favLink=undefined;
+}
- //I think we have caching issues
- favLink.href = canvas.toDataURL('image/png');
- head.appendChild(favLink);
- }
-}
View
@@ -360,6 +360,7 @@
container.style.backgroundColor=bgColor;
setFavCol(ballColor);
+ //setFavCol('black');
}
}

0 comments on commit 9a31de3

Please sign in to comment.