Getting content of a script file using Javascript

前端 未结 8 1193
谎友^
谎友^ 2021-02-07 19:38

I have the following script element in my web page:


Using JavaScript,

8条回答
  •  北恋
    北恋 (楼主)
    2021-02-07 19:44

    unless you load a script as literal text in the page, it does not exist as text. It is interpreted by the browser and melded into the runtime, with any other scripts.

    If you want the source you have to fetch it again,if with Ajax get the responseText.

    It will come from the browser cache, and doesn't have to be downloaded again.

提交回复
热议问题