Hi I tried to get the base URL and file path from my windows URL..But I cant get it..Please correct me..
The URL is:
http://sample.com:30023/portal/site/samples/index.jsp
The current output is:
http://sample.com:30023/index.jsp?
The required output is:
http://sample.com:30023/portal/site/samples/
Code used :
var baseURL = location.protocol + "//" + location.hostname + (location.port && ":" + location.port) + "/";
add location.pathname, so it becomes
Also, why not simply use location.href to get the whole thing?
Good reference at https://developer.mozilla.org/en-US/docs/DOM/window.location