Beiträge

Encoding of null and undefined in a type-safe URI query

When transferring variables in the query part of an URI, encode the JavaScript value null in key=null as ?key. Distinguish between undefined, null and an empty string by omitting the key altogether for undefined and appending an equal sign for the latter. I.e. ?key= stands for key=““. Use the URI.js as helper library for URI query extraction and composition.