All users were logged out of Bugzilla on October 13th, 2018

page JS can't dynamically update favicon

VERIFIED FIXED

Status

VERIFIED FIXED
10 years ago
9 years ago

People

(Reporter: Dolske, Assigned: mfinkle)

Tracking

Trunk
ARM
Other

Details

Attachments

(1 attachment)

(Reporter)

Description

10 years ago
The code on http://isthetreegreen.com dynamically changes the favicon in JS...

<link id="favicon" rel="icon" href="foo.png">
...
var icon = document.getElementById("favicon");
var parent = icon.parentNode;
parent.removeChild(icon);
icon.setAttribute("href", "bar.png");
parent.appendChild(icon);

This works in Firefox, but not Fennec.

Oddly, this works when the page is initially loaded, but I'm guessing that's because there's some latency between Fennec loading the page and showing the favicon.
(Assignee)

Comment 1

10 years ago
Actually, this used to work, but we removed the "change immediately on <link>" because of pageload preformance. We now wait until the page loads to set the favicon. Of course, if the page is already loaded, the update never happens.

So we need to only delay the update if the page is loading. After a pageload, we should update immediately.
(Assignee)

Comment 2

10 years ago
Created attachment 359757 [details] [diff] [review]
patch

This patch should update the favicon, but not affect pageload time. The this._favicon.src is set to "" when we start a pageload and is set to the page's favicon or the default page favicon after a pageload is complete.
Assignee: nobody → mark.finkle
Attachment #359757 - Flags: review?(gavin.sharp)
Attachment #359757 - Flags: review?(gavin.sharp) → review+
(Assignee)

Comment 3

10 years ago
http://hg.mozilla.org/mobile-browser/rev/b6d3d2b8cdec

Taras - you might want to recheck pageload timing
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED
verified FIXED On build:

Mozilla/5.0 (X11; U; Linux armv7l; en-US; rv:1.9.2b1pre) Gecko/20091001
Fennec/1.0b4pre
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.