Skip to content
Coder Cream
View website Menu
  • Home
  • Lifestyle
  • Fashion
  • Travel
  • Contact
  • Your cart
  • Type your search
0 Menu Close
  • Home
  • Lifestyle
  • Fashion
  • Travel
  • Contact
  • Your cart
  • Type your search
  • Browse Blog
  • Contact Us
  • About Us

Blog

You are currently viewing Get Base URL from client side using JavaScript

Get Base URL from client side using JavaScript

This one will help you…

var getUrl = window.location;
var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];

Resources:

https://stackoverflow.com/questions/25203124/how-to-get-base-url-with-jquery-or-javascript

You Might Also Like

Code Snippets for Datatables.js | Examples and Formatting of tables

May 16, 2018

JavaScript replace text in a div element with JQuery Ready

May 10, 2018
  • About Us
  • Contact Us
  • Blog
© Copyright - OceanWP Theme by Nick
×
×

Cart