[deleted]
How to store your app's entire state in the url
191–200 of 416 posts
Re: How to store your app's entire state in the url
#192Earlier quoted context omitted.
Genuinely curious to hear why you are so shocked. Long, ugly, user unfriendly urls are really prevalent. Arguments can be made even query params are pretty ugly.. Are urls expected to be a good UX these days? What's the big deal?
I don't think people care so much about a messy address bar as a messy chat/email message after pasting a URL. Shorteners and vanity URLs exist, but that's more friction than just copying from the address bar as-is. This can be overcome with html, markdown, and other rich text formats that let you specify the visible link text (missing from many chat apps*), but that's also friction to compose compared to automatical…
> *Slack's implementation is awesome: type the link text, highlight it, and paste a URL.
Yes! Matches my vision of hypertext perfectly: I usually type a message in normal human language and then paste links all over it for the reader who needs to dig deeper.
Re: How to store your app's entire state in the url
#193I know of at least one bank where this was exploited, because people see the base url, assume safe, and can't read the embedded escape / javascript in the longer part. Especially when the link is zipped into a little clickable thing and you can't see the URL at all.
Re: How to store your app's entire state in the url
#194Just wondering never created an entire app around this idea
Re: How to store your app's entire state in the url
#195A better idea is to use the URI fragment (the string after the # sign). It has the advantage of not having a size limit, and not needing to be sent all to the backend during the request. `window.location.hash` is your friend.
If you have so many parameters that you need a URL that's over 2048 characters, you should probably be reminded that localStorage exists.
Re: How to store your app's entire state in the url
#196A better idea is to use the URI fragment (the string after the # sign). It has the advantage of not having a size limit, and not needing to be sent all to the backend during the request. `window.location.hash` is your friend.
> It has the advantage of not having a size limit Still though I suppose you could probably gzip it before base64 encoding it for some additional optimization. Extremely long URLs have other UX issues, e.g. sending them on chat apps and having them eat up multiple scroll pages in one URL, like: "Check out this event: http:// ..... ... ... (500 scroll-screen-lengths of just URL) ... ... Here's another event on the sam…
Re: How to store your app's entire state in the url
#197Earlier quoted context omitted.
If a one-time correction has its desired impact, the small addition to the noise reduces future noise.
This is some sort of meta joke, right?
The idea that "complaints about people violating the HN norms is somehow comparable to violating the norms" is trivially wrong if one thinks about it for more than a few seconds.
Re: How to store your app's entire state in the url
#198Earlier quoted context omitted.
Here is it decoded: {"interval":"week","periodicity":1,"timeUnit":null,"candleWidth":4.3486590038314175,"flipped":false,"volumeUnderlay":true,"adj":true,"crosshair":true,"chartType":"line","extended":false,"marketSessions":{},"aggregationType":"ohlc","chartScale":"linear","studies":{" vol undr ":{"type":"vol undr","inputs":{"id":" vol undr ","display":" vol undr "},"outputs":{"Up Volume":"#00b061","Down Volume":"#ff3…
I suspect it's probably a global library that handles this. So refactoring it in one place would be difficult. If I had to guess their implementation looks something like this. SomeUrlService.pushState(JSON.stringify({ foo: 'bar' })); SomeUrlService.navigate('/some/url/here') Likely, that "SomeUrlService" is also tacking on plenty of other shit to the URL that is passed along. I don't work for Yahoo and never have, s…
Re: How to store your app's entire state in the url
#199As some comments suggest, I will move the data from the query string to the URI fragment to avoid the length limitation.
Re: How to store your app's entire state in the url
#200Why not use localStorage or sessionStorage instead of the URL?