Is it safe to use to display images?

后端 未结 3 1596
猫巷女王i
猫巷女王i 2020-12-31 05:51

I\'ve learned that it\'s possible to embed an image in an HTML page like so, instead of linking to a separate image file:



        
3条回答
  •  我在风中等你
    2020-12-31 06:21

    Yes, this is safe - all major browsers support the data URI scheme.

    One downside is that if you use the same image a number of times in the page, it will be encoded several times vs downloaded once.

    Another is the size limit imposed by some browsers (IE 8 only allows up to 32k).

    You can also use this in CSS to mitigate the download issue.

提交回复
热议问题