Replaced hardcoded http with location.protocol