So how do we inject a <script> into absolutely 100% arbitrary HTML? Well, it’s tricky. We’re starting to do it with Cloudflare Workers and the HTMLRewriter stuff they can do. Even then, it’s not particularly easy, with lots of edge cases. Thank gosh for Miniflare for the ability to work on this stuff locally and write tests for it.
00:22 Let’s talk Messing with HTML
03:07 Reasons for messing with HTML
05:48 How and when to inject a script
10:14 Where we show your profile page
14:17 Using Cloudflare workers
The post 373: Script Injection with Cloudflare Workers appeared first on CodePen Blog.