Get the url of currently executing js file when dynamically loaded

后端 未结 3 1772
萌比男神i
萌比男神i 2020-12-16 03:26

So I\'m trying to load a script dynamically and figure out the URL path at which that script was loaded. So some guy gave me a pretty awesome solution to this problem if the

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 03:50

    When your script gets loaded with jQuery (and I guess other frameworks as well), your script will become indistinguishable from a script that was originally in the HTML document.

    jQuery makes a request reaching out for your script and puts back the reply as the text child of a

提交回复
热议问题