Goodbye innerHTML, Hello setHTML – Frontend Masters Blog

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

The new `.setHTML()` method in JavaScript, part of the Sanitizer API, serves as a drop-in replacement for `.innerHTML` with built-in XSS protection. Mozilla introduced this feature in Firefox 148, branding it as a safer alternative. Frederik Braun discusses it in depth on the ShopTalk podcast and shares a recipe to use

1m read timeFrom frontendmasters.com
Post cover image

Sort: