Ask coding questions

← Back to all posts
I cannot add a favicon
NicoSlafter (1)

I am working on a website for my discord bot. I haven’t started anything except adding a GIF I know i’ll keep. I tried to find videos, they didn’t work. Anyone who can help, let me know in the comments and i’ll give you perms to edit.

Comments
hotnewtop
tussiez (1515)

Favicons

In your <head> element:

<link rel="icon" type="image/png" href="rickroll.png">
``
RohilPatel (1535)

You basically copied my answer smh @tussiez

tussiez (1515)

@RohilPatel Oh, didn't see your answer until now.

RohilPatel (1535)

Well hopefully it works for you lol @tussiez

SameeraMurthy (110)

Solution

This is what I do:

<link href="image.png" rel="icon" type="image/png" sizes="16x16">
RohilPatel (1535)

Hey there! I hope this helps. It's not a favicon, but it works for me:

  <link href="something.png" rel="icon" type="image/x-icon" />

If this helps, feel free to mark as right! Have a good one!

19wintersp (1121)

@RohilPatel Only put type="image/x-icon" for Windows ICO files; the type attribute should be the MIME type of the linked resource. For a PNG image, that would be "image/png".

RohilPatel (1535)

Well I really didn't care as it did the trick for me @19wintersp

19wintersp (1121)

@RohilPatel If you did this:

<bOdY>>
<h1 >Hello, world!
< hEaD>

most modern browsers would accept it, and turn it into this:

<!DOCTYPE html>
<html>
  <head></head>
  <body>
    <h1>Hello, world!</h1>
  </body>
</html>

Does that mean that it's alright to code like in the first example?

RohilPatel (1535)

No, however I use ejs and such in html files. Does that mean I'm not allowed to use ejs in them? @19wintersp

19wintersp (1121)

@RohilPatel That has practically nothing to do with what I just said.

NicoSlafter (1)

@SixBeeps Still, it won’t work.

SixBeeps (5062)

@NicoSlafter You never actually uploaded a favicon?

SixBeeps (5062)

@NicoSlafter You uh...
You need to do that in order to set a favicon.

NicoSlafter (1)

@SixBeeps Thank you for your help, I still wasn’t able to but, it’s all okay.