html-minifier-terser icon indicating copy to clipboard operation
html-minifier-terser copied to clipboard

[Bug]: removeAttributeQuotes cause WhatsApp to not load open-graph images

Open nitin2953 opened this issue 1 year ago • 1 comments

What happened?

Using the removeAttributeQuotes, Open Graph (og:image) tags' attribute values without quotes prevent WhatsApp from loading preview images

Before minification (works as expected):

<meta property="og:image" content="https://example.com/image.jpg">

After minification with removeAttributeQuotes (breaks WhatsApp preview):

<meta property=og:image content=https://example.com/image.jpg>

I don't think this bug would impact many users, but a warning in the README file would be helpful to inform developers of this potential issue when using removeAttributeQuotes with Open Graph tags.

Version

v7.2.0

What browsers are you seeing the problem on?

No response

Link to reproduce

No response

Relevant log output

No response

Willing to submit a PR?

No

nitin2953 avatar Sep 08 '24 05:09 nitin2953

http://perfectionkills.com/experimenting-with-html-minifier/#remove_attribute_quotes

Please, use this optimization with care.

To me it looks like valid HTML:

image

Browsers interpret the input like this:

image

For me it seems this is a bug in WhatsApp. If this is a problem, do not use removeAttributeQuotes.

DanielRuf avatar Nov 02 '24 11:11 DanielRuf