Introducing Program Links

May 8, 2023 โ€” Some web apps are designed to load entire programs from a link. But if a program contain certain characters, such as newlines, those links won't work as-is. To create working links you have to run them through encodeURIComponent.

If you are creating blog content by hand this is annoying. To update a program link you have to keep a copy of the program, update that, then run encodeURIComponent, then paste the result into your post.

Today's release of Scroll includes a small new addition that solves this problem. You can call them "Multline Links" or "Program Links".

Here are two examples

Let's start with a small example. View the source of this page to see the code used to generate the program links.

Here is a program link to the Scroll web app.

If you click that link you should see "It worked!" in big green text.

Now let's show a complex real world example. The link below contains a 28 line program pasted verbatim from the Ohayo data science studio.

Discovery of the Elements

If you click that link you should see a few data visualizations generated from that program. If you view the source of this page you can see the unaltered program source. Edit the source and the link will update accordingly. Scroll handles the encodeURIComponent.

Why not use HTML directly?

Modern browsers do their best to make URLs well-formed and you will notice that they auto encode certain characters like spaces. But by the HTML spec newlines are not a URL code point and generally are stripped and collapsed.

Program Links in Scroll handle encoding newlines and any other special characters so you can focus on your content and not the encoding.

by Breck Yunits

View source