In php code: $host = isset($_SERVER[‘HTTP_X_FORWARDED_HOST’]) ? $_SERVER[‘HTTP_X_FORWARDED_HOST’] : (isset($_SERVER[‘HTTP_HOST’]) ? $_SERVER[‘HTTP_HOST’] : ”);
In javascript code: “http://” + top.location.host + top.location.pathname
In php code: $host = isset($_SERVER[‘HTTP_X_FORWARDED_HOST’]) ? $_SERVER[‘HTTP_X_FORWARDED_HOST’] : (isset($_SERVER[‘HTTP_HOST’]) ? $_SERVER[‘HTTP_HOST’] : ”);
In javascript code: “http://” + top.location.host + top.location.pathname