Monday, July 08, 2013

Tutorial: The Easiest Way to Parse URLs with JavaScript

Do you want to share?

Do you like this story?

One of my all-time favorite JavaScript tricks is a technique for parsing URLs into parts (host, path, query string etc) that doesn’t require any libraries or advanced regular expressions. It uses only the power of the DOM, and more precisely, the anchor element <a>.

As part of the regular set of properties that browsers assign to anchor elements, there are a few more that mimic the properties of the location object. Let me demonstrate:

http://tutorialzine.com/2013/07/quick-tip-parse-urls/

YOU MIGHT ALSO LIKE

0 komentar:

Post a Comment

Advertisements

Advertisements