Returns the static base URL of the running app - Node.js String

Node.js examples for String:URL String

Description

Returns the static base URL of the running app

Demo Code


/**//from   ww  w .ja  va 2s.c  o  m
 * Returns the static base URL of the running app.
 * https://events.google.com/io2015/about -> https://events.google.com/io2015/
 */
function getStaticBaseURL() {
  var url = location.href.replace(location.hash, '');
  return url.substring(0, url.lastIndexOf('/') + 1);
}

Related Tutorials