가능한 중복 :
What is my script src URL?동일한 JS 파일에서 JS 파일의 URL을 가져 오는 방법은 무엇입니까?
나는이 상황 : 파일 에서
<script
type="text/javascript"
src="http://server/some.js">
</script>
내가 some.js 같은 파일의 전체 경로를 알 필요가 some.js , eq. "http://server/some.js". 어떻게해야합니까?
HTML 코드를 변경할 수 없습니다 (클라이언트는 JS 파일 포함).
function getScriptFileName() {
return (new Error).fileName;
}
참조 http://stackoverflow.com/questions/984510/what-is-my-script-src-url –