문제

can a javascript document know the url from where is being loaded (not the referer) without url rewriting.

I load http://qqsd.foo/blabla.js loaded on my html page and I want my blabla.js script know this url and the parameters it could have passed.

도움이 되었습니까?

해결책

You could try this

<script src="http://qqsd.foo/blabla.js" id="blabla"></script>

then in your blabla.js file

alert(document.getElementById("blabla").getAttribute("src"))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top