External Javascript File - Is QueryString Information Available?

On the HTML page, I have a link to an external Javascript file, for example:

<script src="http://MyServer.com/js/myscript.js?Happy=True"></script>

Inside myscript.js , when it starts, can I get the Happy = True part similar to the QueryString js source url?

Note. I don't want the url of the HTML page, I need to get the url of the js file.

My guess is no.

+3
source share
1 answer

You will be able to detect the src attribute of the script element (it would be easier to find if it <script>has an identifier). You can extract a Query-String from this URL.

+5
source

Source: https://habr.com/ru/post/1792697/


All Articles