Created
February 18, 2015 12:30
-
-
Save froop/46389c2d0ea36968c33f to your computer and use it in GitHub Desktop.
[JavaScript] URLの親階層を取得
This file contains hidden or 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 getParentURL(url) { | |
return url.replace(/[^/]*$/, ""); | |
} | |
var url = location.href; | |
document.write(url + "<br>"); | |
document.write(getParentURL(url) + "<br>"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment