Maybe I missed something, but if javascript and the page are on the same server, you can just use js to do something like this:
<script>
var pd = parent.document;
var location = pd.location.protocol + "//" + pd.location.host;
alert(location);
</script>
, HTTP javascript, , , URL- .
internal static string GetFullPath(HttpRequest request)
{
Uri uri = request.Url;
string fullUrl = String.Format("{0}{1}{2}{3}", (request.IsSecureConnection) ? "https://" : "http://",
uri.Host, (uri.IsDefaultPort) ? "" : String.Format(":{0}", uri.Port), uri.AbsolutePath);
Int32 index = fullUrl.LastIndexOf("/");
fullUrl = fullUrl.Remove(index + 1, (fullUrl.Length - 1) - index);
return fullUrl;
}