Favicon not showing up when displaying a pdf, how to make it show up?

Viewed 214
import React from "react";
import CoursePDF from "../pdf/course.pdf";

function About() {
  return (
    <div>
      <p><a href={CoursePDF}>here</a>.</p>
    </div>
  );
}

export default About;

When I click on "here", I am shown the pdf, but the favicon doesn't appear, and instead I get the default react.js icon. How would I go about fixing this?

1 Answers

Your pdf is not a regular html page, so your favicon is not defined as it could be in the rest of your app. The fallback is the favicon with the .ico extension in your public folder.

Just put a favicon.ico to the root of your site, then it should work.

Related