Skip to content

Instantly share code, notes, and snippets.

@azu
Created April 17, 2010 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azu/369512 to your computer and use it in GitHub Desktop.
Save azu/369512 to your computer and use it in GitHub Desktop.
// <script type="text/javascript" src="http://example.com/lab/test.js"></script>
// から呼ぶ
var currentScript = (function (e) {
if(e.nodeName.toLowerCase() == 'script') return e;
return arguments.callee(e.lastChild);
})(document);
var currentPath = currentScript.src.split("/").slice(0,-1).join("/"); // http://example.com/lab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment