Web Tools Weekly
What a Tool!

Issue #207  (Framework Love, JS Libs, Jamstack, Uncats)07/06/17

Sometimes I'll read a Stack Overflow thread and appreciate more why people are drawn to frameworks and libraries. This thread originally started in 2009 is a good example of that.

The user's question is fairly simple: How do you get the base domain from a URL. In this case, the user was referring to a URL string, but many of the comments assumed he was talking about the URL of a page, which can be obtained either via the location object, or the document object.

Whatever the case, here are some of the suggestions offered for this seemingly simple task:

  • Use code that splits the URL at the slashes, then deal with the returned value
  • Use location.origin but beware of old browsers that don't support it (though this is probably not an issue today)
  • Don't forget to consider a potential port number
  • Use location.hostname, but beware that this doesn't include protocol and port
  • If it's a string, add the string as a URL of an invisible anchor element and then deal with it using DOM methods for anchor elements
  • Use a regular expression
  • Use document.URL
  • Use a pre-written function (e.g. one that looks for the third forward slash in the URL)
One of my favourite answers is one of the lowest ranked. I like it because this function will return a nice clean easy to use object that has property/value pairs for the different parts of the URL, like a JSON object.

Again, this seems like a simple task, but the number of ways to approach it seems endless. This makes me appreciate more the work that goes into frameworks and libraries that endeavor to provide you with a simple API that bypasses all of this trouble, and why people are drawn to them.

Now on to this week's tools!
Did you buy my previous JavaScript/DOM tips book? I've released a new one...
NEWEST E-BOOK! Volume 2 of JavaScript & DOM Tips

JavaScript Libraries and Frameworks

The popular JavaScript platform and environment for building modern web applications is now at version 1.5.

Reaction Commerce
A fast, scalable, real-time reactive, and open source Node.js commerce platform.

A light-weight MVC framework, written in CoffeeScript that integrates well with modern JavaScript frameworks.

Curated collection of data structures for the JavaScript language.

Google's well-known mobile and desktop framework is now at version 4.x.

Now at version 8.x. Fast 3kB alternative to React with the same ES6 API.

A JavaScript implementation of Flow-Based Programming (FBP), separating the control flow of software from the actual software logic.

Static Sites, CMS's, Site Builders, etc.

A powerful and efficient open-source HTTP server framework and CMS. Provides free HTTP/2 over TLS (via Let's Encrypt), a useful CMS, and a fast HTTP API on which to build modern applications.

GUI web builder to create responsive HTML emails from scratch or using one of the built-in predefined templates.

Create your business website and update it automatically using your Facebook page.

Add a blog or CMS to your website in minutes. A headless CMS and blogging platform built for developers.

Status Pages
Get a free status page for your project.

Modular website compiler (static site generator).

A server operating system aiming to make self-hosting accessible to everyone.

Support Web Tools Weekly on Patreon
Contribute $10 or more and get two JS/DOM e-books + my CSS e-book package.

The Uncategorizables

Pandoc Book Maker Template
A template for creating EPUB books from markdown using pandoc.

Web Archiver
This service lets you snapshot web pages, including all resource files that they reference. Snapshots are stored in an Amazon S3 bucket that you specify.

API List
A big searchable collection of APIs.

Lets you assign a URL to your phone number. Assign as many URLs as you want and use each as a private line.

Stop writing form endpoints. Point your form at Basin and start collecting submissions. No coding required.

Content Snare
Getting clients to send you website content is a painful process and holds up jobs. Use Content Snare to make it easier.

Embed any website seamlessly in PowerPoint and Keynote slides.

Chmod Calculator
Allows you to quickly generate permissions in numerical and symbolic formats.

Password protect a static HTML page. Based on the crypto-js library, StatiCrypt uses AES-256 to encrypt your string with your passphrase in your browser (client side).

A Tweet for Thought

So, are you sure you want to try that new JavaScript framework?

Suggestions / Corrections

Made something? Send links via Twitter @WebToolsWeekly (details here). No tutorials or articles, please. If you have any suggestions for improvement or corrections, feel free to reply to this email.

Before I Go...

Over at Wes Bos's GitHub AMA, someone opened a discussion about how to get your first JavaScript job. Wes invited others to comment, so some of the advice might be useful to those looking for new opportunities.

Thanks to all for subscribing and reading!

Keep tooling,