How to get the file-path of the currently executing javascript code

后端 未结 10 868
南笙
南笙 2020-11-29 19:18

I\'m trying to do something like a C #include \"filename.c\", or PHP include(dirname(__FILE__).\"filename.php\") but in javascript. I know I can do

10条回答
  •  难免孤独
    2020-11-29 19:25

    The accepted answer here does not work if you have inline scripts in your document. To avoid this you can use the following to only target

提交回复
热议问题