iframes.I adore a good iframe.
They’re so elegant as a web component.
Just expose an endpoint, say https://writewithharper.com/editor, set it up to accept some query parameters and get it hosted.
Now you can access this web-component from any page that has a loose enough Content Security Policy.
For me, that means my school assignments and other assorted documentation.
It also means that I can avoid setting up a complex build system for MDX, while still being able to include interactive components.
The example from earlier:
<iframe
src="https://writewithharper.com/editor?initialText=See, we can now embed the the Harper editor%0Arght into this document!%0A%0AIt's a little too easy."
width="100%"
height="400px"
style="border-radius:10px;border:0px"
></iframe>
One major caveat though: when we pass our arguments to the component through the query URL, this gets sent to the component’s server as well. I certainly trust the Harper website’s server, since I maintain it and the code is open source, but that isn’t always the case.
You should also probably avoid doing this too much.
Most browsers spawn a whole new process for every iframe, so if you want things to stay snappy it is best to limit yourself to just one (maybe two) per page.
Published October 13, 2024 at 6:00 AM
Proofread by Harper.
A complete or partial loss of function while reviewing the output of a coding agent.
Back in my day, we used math for autocomplete.
I like HackerNews, but I don't love that so much of it has turned into discussion of a single topic: AI. This is a version of HackerNews, filtered to remove any article focusing on __AI__. Refreshes about every ten minutes.