简体   繁体   English

加载外部javascript,但是针对一个文件javascript反复进行HTTP请求

[英]Load External javascript, but HTTP request repeatedly for one file javascript

I have problem when load external html into specific <div> . 将外部html加载到特定的<div>时遇到问题。 Here is the problem : 这是问题所在:

  1. I have html files, "index.html" and "problem.html" . 我有html文件,分别是"index.html""problem.html"
  2. In problem.html I use skrollr to animate content. 在problem.html中,我使用skrollr为内容设置动画。
  3. When I click the "open" button in index.html, I use jquery load() method to load problem.html into specific in index.html. 当我单击index.html中的“打开”按钮时,我使用jquery load()方法将problem.html加载到index.html中的特定对象中。
  4. The content was loading, but slowly. 内容正在加载,但速度很慢。
  5. When I check using firebug, I see many request skrollr.min.js . 当我使用firebug进行检查时,看到许多请求skrollr.min.js Why do I get skrollr.min.js and other file repeatedly? 为什么我反复得到skrollr.min.js和其他文件?

When I refresh the page, load the menu and see at the firebug there are so many get skrollr.min.js and file that are called. 当我刷新页面时,加载菜单并在Firebug上看到有太多被调用的skrollr.min.js和文件。

You could try to load the Page via iframe to see if it's faster. 您可以尝试通过iframe加载Page,以查看其速度是否更快。 Just set the innerHTML of your container to 只需将容器的innerHTML设置为

<iframe src="http://yourdomain.com/problem.html"></iframe>

when he clicked the Button. 当他单击按钮时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM