I would like to call Javascript in an HTML file like below:
<body>
<script src="./sample.js?ts=123456789&id=31ade2"></script>
</body>
How can I use ts
and id
in sample.js
? Is this even possible?
I searched on Google, but what I found was to use location.href
, which didn't return ts
or id
.
(Explanation why window.location.href
doesn't solve this problem.)
Let's say the script above is in example.com/index.html
. window.location.href
in sample.js
returns example.com/index.html
but not ./sample.js?ts=123456789&id=31ade2
.