adding window.location.origin

adding window.location.origin and adding assertions.