简体   繁体   English

网页永远不会停止加载

[英]Web page never stops loading

I'm currently working on a student project and I encounter an issue with my code. 我目前正在开展一个学生项目,我遇到了代码问题。 We built an e-doc which mixes video, images, sounds and texts datas about people working during the night. 我们建立了一个电子文档,它混合了关于夜间工作人员的视频,图像,声音和文本数据。 It's made of HTML, Javascript and a bit of PHP to access a DB. 它由HTML,Javascript和一些PHP来访问数据库。

Recently we discovered that the page keeps loading infinitely when you arrive on the website... It brokes some of our JS code and we don't know how to identify the ressource that might be corrupted or so... 最近我们发现当你到达网站时页面无限加载......它破坏了我们的一些JS代码,我们不知道如何识别可能已损坏的资源......

What can make a page load "forever" ? 什么可以使页面“永远”加载? And what kind of tools (ie firebugg or the built-in chrome stuff) should we use to identify the problem ? 我们应该使用什么样的工具(即firebugg或内置的chrome东西)来识别问题?

You can find our dev- version right here : http://mgprddev2012.dream-valenciennes.com 您可以在这里找到我们的开发人员: http//mgprddev2012.dream-valenciennes.com

EDIT : PHP Error is now OK, i forgot to upload the newest version of the code on the dev platform. 编辑:PHP错误现在没问题,我忘了在开发平台上上传最新版本的代码。

Many thanks 非常感谢

You're not crazy - this page does indeed take a very, very long time to load. 你并不疯狂 - 这个页面确实需要非常长的时间来加载。

If you look at the Network tab in Chrome Developer tools, you can see that there are a lot of images, audio files and video files loading up all at the beginning, and most of them are not visible right away. 如果您查看Chrome开发者工具中的“网络”标签,您会发现很多图像,音频文件和视频文件在开始时都会加载,而且大多数图像,音频文件和视频文件都不会立即显示。 And some of them are very big. 其中一些非常大。 This is probably one of those situations where it's best to defer loading of most of these assets until you need to display them, or at the very least until after you've loaded the assets you need right away. 这可能是这样一种情况,即在您需要显示它们之前,最好将这些资产的大部分加载推迟,或者至少在您加载所需资产之后。

I recommend checking you YSlow , which is an auditing tool that will give you some tips on how to make your web page load faster and appear to load faster. 我建议检查你的YSlow ,这是一个审计工具,这将使你如何让你的网页加载速度更快一些技巧,而且似乎加载速度更快。 The site also has some good tips and thorough explanations for why different strategies are effective. 该网站还提供了一些很好的技巧和详尽的解释,说明为什么不同的策略是有效的。

A few hints for this particular page: 这个特定页面的一些提示:

  • A lot of your images are pictures of text. 你的很多图像都是文字图片。 Consider rendering these as actual html text. 考虑将这些渲染为实际的html文本。 You can still modify the size of each letter with CSS, and you'll have the added benefit that Chrome will be able to translate the text for non-French-speaking users. 您仍然可以使用CSS修改每个字母的大小,并且您还可以获得Chrome可以为非法语用户翻译文本的额外好处。 You should be able to use CSS borders to get those lines around the text, or try SVG. 您应该能够使用CSS边框来获取文本周围的那些线条,或者尝试使用SVG。

  • Your background image is 2.2 MB. 您的背景图片是2.2 MB。 That's quite big. 那太大了。 Try saving it at a lower compression setting. 尝试以较低的压缩设置保存它。

  • You have a bunch of icons in individual png files. 各个png文件中有一堆图标。 Consider putting them all in in one file and display them as CSS Sprites . 考虑将它们全部放在一个文件中,并将它们显示为CSS Sprites

  • There are several png files that look like they could be jpg's, except for the transparency. 除了透明度之外,有几个png文件看起来可能是jpg的。 If you're feeling ambitious, you can make a jpg with the color channels on the left side, and the alpha channel rendered as grayscale on the right, and use canvas to composite them. 如果您有野心,可以在左侧使用颜色通道制作jpg,在右侧使用灰度渲染Alpha通道,并使用画布合成它们。

  • You also have a few png files containing sprites for animation. 你还有几个包含动画精灵的png文件。 You can convert them to videos and try the same canvas trick as above. 您可以将它们转换为视频并尝试与上面相同的画布技巧。 If you're willing to use WebGL, I have some code you can use. 如果您愿意使用WebGL,我可以使用一些代码。

Stops loading fine for me. 停止加载对我来说很好。 Firebug will usually tell you if something is loading in the background. Firebug通常会告诉你是否有东西在后台加载。 Look at the console area to see if any thing is stalling upon page load. 查看控制台区域以查看是否有任何事情在页面加载时停止。 Are you saying in it's current state it hangs, because for me it finished just fine. 你是说它的当前状态是挂起的,因为对我来说它完成得很好。

In the console you can also see javascript errors that may cause things to not work properly. 在控制台中,您还可以看到可能导致无法正常工作的javascript错误。

In JavaScript console: 在JavaScript控制台中:

Uncaught TypeError: Cannot call method 'pause' of undefined debout.js:979

It says that debout.pop02 is not declared. 它说debout.pop02没有声明。 Where do you initialize it? 你在哪里初始化它?

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

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