Display an .ico within an image element

后端 未结 2 927
粉色の甜心
粉色の甜心 2020-12-31 02:37

I\'m trying to display an .ico within an image element but in Internet Explorer it does not work/show. This is my code:



        
2条回答
  •  渐次进展
    2020-12-31 03:05

    You can always put the base64 representation of an icon in the src attribute. It will look like this:

    
    

    where ... will be the base64 representation.

    If you need a tool for conversion from icon to base64, you can use Base64.Guru encoder for example.

    Here is the snippet with Google favicon encoded in the base64 representation:

    If you ever need to convert an image to base64 by yourself using JavaScript, here are some good examples how to do it: How to convert image into base64 string using javascript.

提交回复
热议问题