News for hackers. Stuff that matters.
Re:A URL Lengthener by jstrieb on Friday May 14, 2021 @02:40PM (#27158115)
I spent some time looking at similar specs for more recent browsers, but wasn't able to find anything useful. This was for a proof-of-concept I made that stores entire web pages in URLs (creatively named "URL Pages") by base64-encoding them and putting them in the URL fragment (the part after the "#").

https://github.com/jstrieb/urlpages

The URLs this thing generates get pretty damn big sometimes, since I never got around to implementing compression. I can confirm that massive URLs from pages with inline images do work, but probably take some not-so-optimized code paths because they make my computer's fans spin up. Click at your own peril:

https://git.io/Jss7V

Re:A URL Lengthener by willcipriano on Friday May 14, 2021 @03:03PM (#27158404)
I made a service to store arbitrary files as URLs that is similar. The hard part is files that are too large, I can handle files up to 5mb if you click on them all via local storage. Compression helps a lot as making them base64 increases the size quite a bit.

https://podje.li

Re:A URL Lengthener by prox on Friday May 14, 2021 @04:49PM (#27159528)
Could you make whole webpages just through urls? Such as they will completely portable? Portable being taken with a grain of sand ofc.
Re:A URL Lengthener by boomlinde on Saturday May 15, 2021 @03:47AM (#27163282)
Yes, I did this for self-contained reports in maybe 2014. All images referenced (containing diagrams) were embedded as data URIs. Restrictions are AFAIK more picky now, though so YMMV in 2021.
Re:A URL Lengthener by prox on Sunday May 16, 2021 @05:32AM (#27172449)
Cool project! It is kind of interesting that the link is the content, not sure it’s always useful, but for twitter like short form content perhaps?
Re:A URL Lengthener by makapuf on Saturday May 15, 2021 @03:58AM (#27163337)
Well webpages themselves including links, the embedding would need to be recursive.
Re:A URL Lengthener by lurkerasdfh8 on Friday May 14, 2021 @05:20PM (#27159844)
not the entire content, but a hash id is pretty common https://en.wikipedia.org/wiki/Magnet_URI_scheme
Re:A URL Lengthener by naugtur on Friday May 14, 2021 @04:13PM (#27159189)
I needed to send data over GET in 2012/2013 and built my own tiny LZW-alike compression to squeeze as much as possible into the 100kb which seemed to be the safe limit for non-ie browsers at the time
Re:A URL Lengthener by drewzero1 on Friday May 14, 2021 @08:51PM (#27161234)
That's really interesting, I'd wondered if that was feasible! A few years ago I needed to send myself notes and URLs from a work computer to look at later, so I put it into the browser as https://< my website >.com/index.html?saveforlater=note%20to%20myself

When I got home I'd search the server logs for "saveforlater" and retrieve my note. Though it might have been faster to just write it on a slip of paper.

Re:A URL Lengthener by naugtur on Friday May 14, 2021 @04:14PM (#27159194)
Re:A URL Lengthener by Moru on Saturday May 15, 2021 @03:14AM (#27163141)
I did that too, but the limit in my language was around 1024 characters in URL's so had to make small packets to send data.
Re:A URL Lengthener by jfrunyon on Friday May 14, 2021 @02:55PM (#27158306)
Okay, but you can already store web pages in URLs. `data:text/html,<h1>Hi%20there!</h1>`

You can even base64 encode them, if you want to.

Re:A URL Lengthener by jstrieb on Friday May 14, 2021 @02:57PM (#27158334)
This is true, but linking to data URIs no longer works. Many browsers block them for "security reasons." In Firefox, a link to that page is not clickable for me:

https://git.io/JssFK

From a convenience standpoint, it's also far less likely that a URL with an http: scheme will be blocked by a random web application than one with a data: scheme. For example it makes sharing on social media sites and chat applications more feasible.