Last active
August 29, 2015 14:00
-
-
Save madeinnordeste/e7259ccfd488b26ed10d to your computer and use it in GitHub Desktop.
Javascript - Base URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_settings() { | |
var doc_location = document.location.href; | |
var url_strip = new RegExp("http:\/\/.*\/"); | |
var base_url = url_strip.exec(doc_location); | |
var settings = { "base_url" : base_url } | |
return settings; | |
} | |
settings = get_settings(); | |
alert(settings.base_url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment