我制作了网站,其中各种其他页面内置为带有 i 框架的“应用程序”:
<iframe id="frame1" src="./app1.php">
<iframe id="frame2" src="./app2.php">
在这些应用程序中,执行了 javascript 代码,其中包括非常高频的 HTTP 请求。
$('#app1button').click(function () {
//Here i have to stop the HTTP-Requests which where fired from the JS of App2
hideAllApps();
showApp(app1);
});
app1 非常频繁地从服务器轮询信息:
app1.php 中有 Javascript::
Handler = window.setInterval(getStatus, 100); //start status messages
当我现在单击 app2 时,会弹出另一个应用程序,由于性能原因,我想停止在 app1.php 中加载的 javascript。
$('#app2button').click(function () {
//Here i have to stop the HTTP-Requests which where fired from the JS of App1
hideAllApps();
showApp(app2);
});
我怎样才能做到这一点?你有什么想法?
提前致谢。