本文介绍了如何动态卸载javascript文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Ajax包含页面,但我还需要包含各自的javascript文件,这需要同时从内存中删除以前的javascript文件。

I am including pages using Ajax but I also need to include their respective javascript files, which requires removing the previous javascript files from memory at the same time.

如何我可以卸载当前加载的javascript文件(以及它们在内存中的代码),以便我可以加载新页面的文件吗?它们很可能会发生冲突,因此加载了多个独立文件的javascript文件。

How can I unload the currently-loaded javascript files (as well as their code in memory) so that I can load the new page's files? They will more than likely conflict, so having multiple independent files' javascript files loaded.

推荐答案

这听起来像你需要重新评估你的设计。您需要删除ajax,或者您不需要在方法名称中发生冲突。

This really sounds like you need to reevaluate your design. Either you need to drop ajax, or you need to not have collisions in you method names.

您可以查看以下链接:

You can review this link: http://www.javascriptkit.com/javatutors/loadjavascriptcss2.shtml

其中提供了有关如何从DOM中删除javascript的信息。但是,现代浏览器会将代码留在浏览器的内存中。

Which gives information on how to remove the javascript from the DOM. However, modern browsers will leave the code in memory on the browser.

这篇关于如何动态卸载javascript文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 22:24