Parse host to get cookie domain

This fix parses window.location.host to set cookie on domain- not on sub-domain-level to solve the cross-domain-policy problem