Is it possible to get information about the file (file name, path) of the javascript file after the document is ready without knowing how many scripts or the order in which they are downloaded?
i.e.
<html>
<head>
<script src="http://www.example.ex/js/js1.js" type="text/javascript">
<script src="http://www.example.ex/javascript/js2.js" type="text/javascript">
<script src="http://www.example.ex/scripts/js3.js" type="text/javascript">
<...>
Where the js2.js file has something like this:
$(document).ready(function() {
}
I could do
var scripts = document.getElementsByTagName("script"),
scriptLocation = scripts[1].src;
but the index "[1]" must be dynamic, because I do not know the order of the loaded scripts.
Miawa source
share