Skip to content

Instantly share code, notes, and snippets.

@blakewrege
Created September 28, 2015 17:12
Show Gist options
  • Save blakewrege/dd062af35840d64e5c0b to your computer and use it in GitHub Desktop.
Save blakewrege/dd062af35840d64e5c0b to your computer and use it in GitHub Desktop.
Fixes url base path
<!-- Change base dependent on system -->
<p id="test"></p>
<script>
function urlpath() {
var hosts = window.location.href;
if (hosts.indexOf("brp9209") > -1) {
var strLink = "https://cs.wmich.edu/~brp9209/CS3500/";
} else if (hosts.indexOf("pmp2439") > -1) {
var strLink = "https://cs.wmich.edu/~pmp2439/CS3500/";
} else {
var strLink = "/CS3500/";
}
return "<base href = " + strLink + " />";
}
document.getElementById("test").innerHTML = urlpath();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment