页面加载 - 白色“闪光”页面之间

发布于 2024-09-19 07:42:11 字数 430 浏览 8 评论 0原文

有两个网站,一个正在运行,一个正在开发中。我正在将一个站点移植到 Zend Framework(出于可维护性/集成目的)。

原始(实时)站点具有无缝页面加载 - 它将加载,然后更新屏幕上的内容,同时保留页面上的背景图像、导航等。

移植的网站(开发)会“闪烁”完全白色一小会儿,然后所有内容同时出现。

据我了解,这不是 FOUC(无风格内容的闪现)。这两个网站上的内容始终显示符合所有 CSS 规则的完整样式。这两个网站在渲染时看起来完全相同,它们使用相同的图像、CSS 和 HTML 标记。唯一的区别是一个(开发)由 Zend Framework 提供服务,另一个(实时)由过程 PHP 提供服务。

造成这种情况的主要原因是什么?这是 ZF 的已知错误/配置问题吗?我以前也遇到过这个问题,没有使用ZF,但没有解决。

感谢您的帮助。

There are two websites, one live one under development. I am porting a site to Zend Framework (for maintainability/integration purposes).

The original (live) site has seamless page loads - it will load, then update the content on the screen while keeping the background image, navigation etc on the page.

The ported site (development) "flashes" completely white for a brief moment then all of the content appears simultaneously.

From what I understand, this is not a FOUC (flash of unstyled content). The content on both of the sites always appears fully styles with all CSS rules. The two sites look identical when rendered, they use the same images, css, and HTML markup. The only difference is one (development) is being served by Zend Framework and the other (live) by procedural PHP.

What are the main causes for this, and is this a known bug/configuration issue with ZF? I've had this problem before without using ZF and did not resolve it.

Thanks for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

救赎№ 2024-09-26 07:42:11

尝试将 javascript 放在页面底部、结束正文标记之前。这应该会加快页面渲染速度,因为加载 javascript 会阻止其他下载(CSS、图像等),从而使页面保持空白,直到所有脚本加载完毕。

Try putting javascript at the bottom of the page, just before the closing body tag. This should speed up page rendering as loading javascript blocks other downloads (css, images, etc.) therefore leaving your page blank until all of your scripts have loaded.

怪我入戏太深 2024-09-26 07:42:11

它可能是您的网络服务器。尝试将服务器的 HTTP 标头与 http://web-sniffer.net/ 等网络嗅探器进行比较并查看缓存标头是否有任何差异。如果有,那么您的浏览器将转储所有内容并重新开始,在某些情况下这看起来几乎就像 FOUC。

It could be your web server. Try comparing the HTTP headers of your servers with a web sniffer like http://web-sniffer.net/ and see if there's any difference in caching headers. If there is, then your browser is dumping everything and starting fresh, which could look almost like a FOUC in some circumstances.

最终幸福 2024-09-26 07:42:11

框架在输出任何内容之前评估控制器逻辑并呈现页面主体是很常见的;这可能会导致数据发送到客户端的延迟,您的旧页面(我猜)会立即转储页面的标题。

It's pretty common for frameworks to evaluate the controller logic and render the body of the page before outputting anything; this can lead to delays in data being sent to the client, where your old page (I'm guessing) dumps the header of the page immediately.

相思故 2024-09-26 07:42:11

好吧,我过早地接受了答案。导致这个问题的原因实际上是 SWFObject!我在开发新网站时注意到了这一点,并且它表现出了相同的行为。我相信这只发生在版本 2+ 中,但对于其他在页面加载之间存在背景闪烁问题(而不是一次显示所有渲染的 HTML)并且碰巧在这些页面上调用 swfobject 的人 - 删除它并尝试一下。这也可能只是你的问题。

澄清一下,我在移植网站时已更新到较新版本的 SWFObject。

Alright, I accepted an answer prematurely. What was causing this issue was in fact SWFObject!! I noticed this when developing for a new site, and it was exhibiting the same behavior. I believe this only happens in version 2+, but for anyone else that has the problem of the background flashing between page loads (as opposed to displaying all the rendered HTML at once) and happens to have swfobject being called on those pages - remove it and give it a go. It may just be your problem too.

To clarify, I had updated to a more recent version of SWFObject when porting the site over.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文