Question

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.

Était-ce utile?

La solution

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"))
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top