Barış Altun
Barış Altun

Reputation: 1

Can I put HTML in chrome extension's icon

Can I put a HTML code in my chrome extension's icon? According to the Google API (setBadgeText) this isn't possible. Is there any way to put it there?

Upvotes: 0

Views: 81

Answers (2)

Xan
Xan

Reputation: 77523

While .setBadgeText is, as implied by name, text-only, you can draw anything and set that as your icon.

You'll need to draw on a <canvas>, extract image data and use .setIcon({imageData: /*...*/}) to update the icon.

See this question for a brief example, and maybe this article.

It's not quite "using HTML", but with some work you can output anything to your icon.

Upvotes: 2

woxxom
woxxom

Reputation: 73566

Badge is plain text only as can be seen in source code. There's no way around.

Upvotes: 0

Related Questions