使用警报后图像加载缓慢,为什么?
我有一个包含以下 php 的页面:
<?php
$mail = $_GET["mail"];
if ($mail == "true"){
echo '<script type="text/javascript">alert("Mail sent successfully! Check your inbox!");</script>';
}
if ($mail == "false"){
echo '<script type="text/javascript">alert("Mail sending failed, please try again later :<");</script>';
}
?>
index.php 仅从邮件发送 php 获取该变量。
问题是我必须将它放在正文的末尾,以便正文首先加载(因此警报弹出窗口不会显示在白色背景上),但图像不会首先加载,并且在我单击“确定”后在警报窗口中,它们加载速度非常慢(所以我认为它们在一段时间后开始加载)。为什么会这样呢?
I have a page that has the following php:
<?php
$mail = $_GET["mail"];
if ($mail == "true"){
echo '<script type="text/javascript">alert("Mail sent successfully! Check your inbox!");</script>';
}
if ($mail == "false"){
echo '<script type="text/javascript">alert("Mail sending failed, please try again later :<");</script>';
}
?>
It's index.php that only gets that variable from a mail sending php.
Problem is I had to put it at the end of body so the body loads first (and thus the alert pop-up doesn't show on a white background), but images doesn't load first and, after I click "ok" in the alert window, they load awfully slow (so I think they start loading after a while). Why could this be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您应该等待整个页面加载后再发出警报。
请参阅此处。
Perhaps you should wait for the whole page to load before making an alert.
See here.