Search This Blog

Thursday 24 July 2014

How to find the current URL path--- Host name + Project Name (Javascript)

Virtual Assistant - Search Engine Optimization - Web Development
In Javascript: 

var urlpath = "http://" + window.location.host + "/" +
window.location.pathname.replace(/^\/([^\/]*).*$/, '$1') + "/";

Server Side:

<% 
    /* Global Variables */
    string hostUrl = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;
    

%>




No comments:

Post a Comment