Unload files loaded with getScript?

后端 未结 5 1678
醉酒成梦
醉酒成梦 2020-12-10 06:57

With $.getScript I can load js files on the fly. Is it possible to \"unload\" some of these files ?

I have a ajax-based administrative panel. I have 3 sections. When

5条回答
  •  长情又很酷
    2020-12-10 07:34

    "Unloading", if it were really possible, wouldn't make much sense here. Let's take a step back and look at why you don't load all the files to begin with:

    • They're another HTTP request and X bytes, if you don't need them, don't get them
    • They have unwanted effects - you don't want what script X does to happen here

    Now look at it from the other side, you have loaded them, which means both of the above have already happened, you paid the request cost of getting them and what they've done. Also, what effect they had on the page can't be generically undone. Just by removing a

提交回复
热议问题