how to get base url javascript code example
Example 1: js get base url
var url = window.location.origin;
Example 2: find base url in javascript
var base_url = window.location.origin;
var host = window.location.host;
var pathArray = window.location.pathname.split( '/' );
Example 3: javascript get base url
console.log(window.location.origin);