Update main.js for more efficient url handling

Strips www.
Resubmission of previous commit