0

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.

Christophe Debove
  • 6,088
  • 20
  • 73
  • 124

1 Answers1

1

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"))
Qusai Jouda
  • 1,048
  • 8
  • 12