0

In my javascript I open a new window (page B) when a user clicks on a button on page A, and everything is working as expected on page B except that the favicon is not showing up (in chrome it doesn't appear, on firefox it works fine). The tag appears to be correct, and when I put the href val for the favicon in the browser the favicon is showing as expected (attached image).

There is an answer from 2012 to another question that is very similar, although I was hoping a new solution might have been figured out since then, and that solution isn't going to work for my goal.

I could upload the favicon to a site (non-local), but this won't work if I wanted to make my favicon dynamic (which I do).

<link rel="shortcut icon" type="image/png" href="http://localhost:3000/images/favicon.png">

enter image description here

I am using node and express and tried this setting as well, but this only works on Page A, and not Page B:

var favicon = require('serve-favicon');
app.use(favicon(path.join(__dirname, 'public', 'favicon.png')));

Are there any other strategies that the SO community has figured out? Thanks.

Community
  • 1
  • 1
Ron I
  • 4,090
  • 8
  • 33
  • 64

1 Answers1

0

You could try this way it should work

var favicon = require('serve-favicon');

app.use(favicon(path.resolve('public/favicon.ico')));
Hitesh Balar
  • 181
  • 3
  • 13