Get Query String Parameters

For years we wrote gross regular expressions to get query string values but those days are gone — enter the amazing URLSearchParams API:

// Assuming "?post=1234&action=edit"

var urlParams = new URLSearchParams(window.location.search);

console.log(urlParams.has('post')); // true
console.log(urlParams.get('action')); // "edit"
console.log(urlParams.getAll('action')); // ["edit"]
console.log(urlParams.toString()); // "?post=1234&action=edit"
console.log(urlParams.append('active', '1')); // "?post=1234&action=edit&active=1"

Thank you for reading!

Marketers Can’t Wait to Use AMP for Email, But Here’s What Will Be Holding Them Back

You would think I would be more excited about this, as it’s a new technology for email, which doesn’t come along very often, but I feel this could be the Flash of email. It’s starts out cool, but in the end is causes more problems than it solves.

Thank you for reading!