localhost equal to location.hostname code example
Example 1: js origin without port
// origin without the port
`${window.location.protocol}//${window.location.hostname}`
Example 2: js host without port
// host without the port
window.location.hostname