Giter Site home page Giter Site logo

Comments (2)

jstrieb avatar jstrieb commented on June 1, 2024 1

Thanks for using URL pages!

This is very interesting, and totally possible that the "published" URLs are longer. While I was working on Link Lock, I realized that oddities with atob and btoa in JavaScript that necessitated calls to encodeURIComponent could be avoided by using my own implementation of base64 encoding. These calls to encodeURIComponent are most likely a factor in the URL length disparity.

Since releasing Link Lock a little while ago, I have been thinking about the best way to remove unnecessary URI encoding while preserving backwards compatibility. I'm thinking doing of something like I do in the Link Lock code, where the "published version" of URLs have a base64-encoded JSON object in the hash, which contains version information in addition to page data. That way if the decoder fails to decode valid JSON, it assumes it's using the original version. Likewise, future versions can have their own decoding schemes.

This is good motivation to give the code a much-needed tune-up. I will leave this issue open for now and investigate further over the weekend. Hopefully this resolves the issue of published URLs being longer. Thanks again for pointing this out, it is very helpful!

from urlpages.

jstrieb avatar jstrieb commented on June 1, 2024 1

Finally got around to pushing the fixes to make the links slightly shorter. While I was at it, I restructured the code as a versioned API so that in the future I can add support for page compression, as well as any other features I have not thought of yet.

In most cases, the updated code seems to have reduced overall URL size. For example, a sampling of the pages in the examples directory shows:

$ du -h examples/*.html
348K    examples/embed-page-old.html
328K    examples/embed-page.html
256K    examples/food-blog-old.html
112K    examples/food-blog.html
372K    examples/nyt-old.html
268K    examples/nyt.html
252K    examples/project-page-old.html
268K    examples/project-page.html

Note that the project-page.html URL is larger because GitHub has changed their interface since I made the original link.

I am now closing this issue. Thanks again!

from urlpages.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.