The https check should come first

A similar change was made to ui.js in #252.
Removed trailing white space terds
Merge pull request #303 from retr0h/https-first

The https check should come first.