JavaScript To Convert Bytes To MB, KB, Etc

I’m currently writing a converter for the HAR file format, which is used by Firebug, Chrome Developer Tools, JMeter, etc to record information about a page loading. The HAR format stores the size of downloaded components in bytes. I wanted to convert this into KB, MB, etc, for display.
Continue reading

How To Get The Domain From A URL Using JavaScript

| Created: August 29th, 2011
JavaScript Development 12 Comments

I’m sure this is a common problem: getting the domain or host name from a URL using JavaScript. There are certainly many solutions to this problem out there. However, the solutions I found weren’t robust enough for my needs, so I ended up writing my own.
Continue reading