tweaked isSecure, removed ajax