Update collections.js

Add localhost support and check for no collections situation.