Chrome not rendering SVG referenced via

后端 未结 21 1681
孤独总比滥情好
孤独总比滥情好 2020-11-29 02:35

I am having issues with google chrome not rendering svg with an img tag. This happens when refreshing the page and initial page load. I can get the image to show up by \"

21条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 03:13

    Content type in the HTTP header from the server was the problem for me. I have a node.js server, added:

    if( pageName.substring(pageName.lastIndexOf('.')) == '.svg' ) {
      res.writeHead(200, { "Content-Type": "image/svg+xml" });
    }
    

    pageName is my local variable for what is requested.

    My guess is this is a common problem! Am using the current version of Chrome (Mar 2020).

提交回复
热议问题