Ombyggnad 2026/2027 pågår - döda länkar förekommer. Mer information

Enklare hantering av webbadresser med URI.js

2012-01-02 på Anders Ytterströms webblogg

I still can't believe javascript - the f**ing backbone-language of the web - doesn't offer an API for mutating URLs. Browsers (Firefox) don't expose the Location object (the structure behind window.location). Yes, one could think of decomposed IDL attributes as a native URL management library. But it relies on the DOM element <a>, it's slow and doesn't offer any convenienve at all.

How about a nice, clean and simple API for mutating URIs:

::: {.highlight} ::: {.CodeRay} ::: {.code} ::: {.CodeRay} ::: {.code} var url = new URL("http://example.org/foo?bar=baz"); url.addQuery("foo", "bar"); ::: ::: ::: ::: :::

URI.js is here to help with that.

via github.com

Klockrent bibliotek som kan bli nog så användbart i en webapp som arbetar mycket mot URIs.


Ovanstående inlägg publicerades 2012-01-02. Det går att prenumerera på denna webblogg. Härifrån är följande mål rekommenderade: