Set the favicon href directly on Webkit browsers

We still delete and re-create the node on other browsers.

Fixes #960.

(imported from commit 3f0862793042c4a52d18104060ac2fe2ad21b3e6)
This commit is contained in:
Keegan McAllister
2013-02-25 15:59:35 -05:00
parent 64bb48421b
commit d4e02f10eb

View File

@@ -17,12 +17,19 @@ exports.reset_favicon = function () {
}; };
exports.set_favicon = function (url) { exports.set_favicon = function (url) {
// I'm not sure whether setting the href attr on the existing if ($.browser.webkit) {
// node would be sufficient. Notificon recreates the node. // Works in Chrome 22 at least.
$(favicon_selector).remove(); // Doesn't work in Firefox 10.
$('head').append($('<link>') $(favicon_selector).attr('href', url);
.attr('rel', 'shortcut icon') } else {
.attr('href', url)); // Delete and re-create the node.
// May cause excessive work by the browser
// in re-rendering the page (see #882).
$(favicon_selector).remove();
$('head').append($('<link>')
.attr('rel', 'shortcut icon')
.attr('href', url));
}
}; };
exports.make_loading_indicator = function (container, text) { exports.make_loading_indicator = function (container, text) {