ui-avatars icon indicating copy to clipboard operation
ui-avatars copied to clipboard

Issue with MS Edge

Open amrsalama opened this issue 4 years ago • 24 comments

There is a weird behaviour in MS Edge, The image shifted to the top, any ideas ? Thanks!

Screenshot from 2019-10-21 20-49-18

amrsalama avatar Oct 21 '19 18:10 amrsalama

No problem on my side.

hotgeart avatar Oct 30 '19 22:10 hotgeart

I am getting this issue as well. It works fine in Edge if you load it directly as @hotgeart did but if you include it in a web page with HTML the letters are not centred as the image shows which @amrsalama included. The same page does work fine on Firefox and Chrome.

I confirm that this bit of HTML will produce the error in Edge on my Windows 10 PC (tried several different PCs):

<div style="padding-top:3px;"><img width="115" height="115" title="Test" class="userphoto" alt="" src="https://ui-avatars.com/api/?name=TT&amp;color=FFFFFF&amp;background=784DD1&amp;size=128"><br>Status: offline</div>

Here is a JSFiddle showing the issue (must use Microsoft Edge to see the problem)

https://jsfiddle.net/y9sor1xc/

eSilverStrike avatar Nov 07 '19 12:11 eSilverStrike

We are also getting this issue, I think it is to do with the type of image you get back which is dependent upon the accept request header sent by the browser. When called from an <img> tag in Edge then the header is

   Accept: image/png, image/svg+xml, image/*; q=0.8, */*; q=0.5

Which results in the image type in the response being svg.

image

cwmrowe avatar Nov 20 '19 06:11 cwmrowe

On further investigation I'm not sure if it is the Accept header that is the problem, I tried it in Postman and got the correctly rendered image, but I am sure it is one of the request headers that's causing this issue.

cwmrowe avatar Nov 20 '19 06:11 cwmrowe

I don't like the idea that a developer has not responded yet to this issue. I hope this project is not dead as we just incorporated it into our code.

@LasseRafn are there plans to continue to work on this project? I understand if you don't have time at the moment to work on a fix but it would make us feel better if their was some sort of response.

Thanks

eSilverStrike avatar Dec 10 '19 22:12 eSilverStrike

I’m open for ideas and PRs

I haven’t really ever worked with EDGE and SVGs so I am unsure what a solution might be

We could add an option to force PNG, for when Edge support is a must? Or if someone knows how to fix it, that’s even better 👍🏻

LasseRafn avatar Dec 11 '19 00:12 LasseRafn

I think we should wait. The 15 janv the new Edge based on chromium will be out. So the bug will disappear on its own. No?

source: https://blogs.windows.com/msedgedev/2019/11/04/edge-chromium-release-candidate-get-ready/#ck6RfDbJ1POYcebm.97

hotgeart avatar Dec 11 '19 06:12 hotgeart

Is anyone running the Beta version of Edge to see if it is actually fixed? It still may not be if Chromium hands off rendering images or something...

If the new Edge fixes the issue it will still be a while before everyone is using it.

It's weird how it works fine in Edge if you access the image directly... cwmrowe seems to be onto something.

eSilverStrike avatar Dec 11 '19 12:12 eSilverStrike

@eSilverStrike https://i.imgur.com/8RVSyyK.png It looks fine to me

hotgeart avatar Dec 11 '19 16:12 hotgeart

IE 11 also have this bug. And unfortunately, in enterprise environments, IE 11 is not near disappearing yet.

stof avatar Dec 17 '19 16:12 stof

I tried installing Edge on Mac, to see how it looks (using the example from @hotgeart, http://jsfiddle.net/y9sor1xc) but could only find a beta which renders correctly, I guess it uses Chromium. I haven't been able to test it myself.

Anyone against simply having Edge return a PNG? as in:

User-agent is Edge/IE = return png no matter accept headers.

Unless of course someone has a proper solution? The SVG is valid and (as per other browsers) does work.. So I'd say its a Edge issue.

LasseRafn avatar Dec 20 '19 23:12 LasseRafn

What are the disadvantages of returning a png? If it is just the size of the file then I don't have a problem as I rather have it look correct.

eSilverStrike avatar Dec 21 '19 15:12 eSilverStrike

Nothing except not using SVGs 👍 I can switch it to PNG-only by checking user-agent?

LasseRafn avatar Dec 21 '19 16:12 LasseRafn

Another negative I guess would mean that you may have to store not only svg but png files as well on your web server.

Internet explorer and Edge both suffer from this issue so you want to detect all Internet Explorer browsers and Edge up to whatever version just before they start to use Chromium. User Agent is the only way I know of.

eSilverStrike avatar Dec 21 '19 17:12 eSilverStrike

Anything that makes it render right is great. Doesn't really matter if it's SVG or PNG. Thanks and Merry Christmas!

cwmrowe avatar Dec 21 '19 18:12 cwmrowe

anyway, it looks like a bug in online api service webserver config / api since it duplicates almost all headers content image

nullifiedtsk avatar Feb 17 '20 08:02 nullifiedtsk

@LasseRafn is the source code in this repo actually used ? From what I can tell, the source code here will never produce a SVG at all.

stof avatar Mar 05 '20 15:03 stof

@stof Thanks for pointing this out! Some changes were never synced 👎 I'll bring it up to date.

@nullifiedtsk This should hopefully be fixed now — however I will look into it

I'm pushing a fix soon which should make it render PNG for IE/Edge always. I don't particularly like this (as new Edge works fine) but lets do this for now and see if we can remove it in the future.

Apologies for the slow handling

LasseRafn avatar Mar 05 '20 15:03 LasseRafn

Actually, Chrome and Firefox are getting PNG, not SVG (and maybe new Edge too, but untested).

Here are the Accept header for <img> tags:

Chrome: image/webp,image/apng,image/*,*/*;q=0.8 Firefox: image/webp,*/* IE 11: image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5 Edge 18: same than IE 11

stof avatar Mar 05 '20 16:03 stof

So to me, this says that only browsers in which we have an issue are receiving the SVG avatar, so it might be broken.

Btw, IE 11 on Windows 7 has an additional issue. due to the height attribute on the <svg> tag, it overwrites the height: auto of the <img> in CSS

stof avatar Mar 05 '20 16:03 stof

I added a parameter to force the format in #41

stof avatar Mar 05 '20 17:03 stof

@stof I'll look into the height — wondering how we will fix that though.. I dont have access to Windows 7 at the moment 👎🏻

Actually, Chrome and Firefox are getting PNG, not SVG (and maybe new Edge too, but untested).

Indeed weird! Safari passes a SVG to accept but maybe other browsers dont. Is this for newest versions?

LasseRafn avatar Mar 06 '20 09:03 LasseRafn

This is for Firefox 73.0.1 (current stable channel) and Chromium 80 (current stable)

stof avatar Mar 06 '20 10:03 stof

To be clear to anyone who is getting this issue in IE11/Edge, the fix is to add &format=png on the request so that IE11/Edge gets a PNG in response. I've actually noticed that it'll randomly get back a PNG or an SVG if you do not specify &format=png.

jcrooke avatar Sep 07 '20 13:09 jcrooke