可以卸载动态加载的 JavaScript 吗? [英] Can dynamically loaded JavaScript be unloaded?

查看:22
本文介绍了可以卸载动态加载的 JavaScript 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个具有静态外部外壳"和动态内容部分的 Web 应用程序.当用户浏览系统时,动态内容部分有许多更新.当加载一个新的内容块时,它也可以选择加载另一个 JavaScript 文件.以良好的内务管理为名,我从 DOM 中删除了适用于旧内容块的脚本块,因为不再需要该 JavaScript.

I am writing a web application that has a static outer "shell" and a dynamic content section. The dynamic content section has many updates as users navigate the system. When a new content block is loaded, it may also optionally load another JavaScript file. In the name of good housekeeping, I remove script blocks from the DOM that apply to old content blocks, since that JavaScript is no longer needed.

接下来问题来了,当我意识到虽然我已经从 DOM 中删除了

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆