简体   繁体   中英

How to make an incomplete page loading checker

So I already asked the question in the title . what I want to do is similar to what facebook mobile site (iPhone version) does . if there's A SLOW internet connection , it shows you a message : Can't load page ! or something like that . how can this be done in js (or) php ? I tried onerror"myfunction()" attribute in HTML but it didn't work :/

use js. in top of page(ie:very after tag),add js like this:

<script type="text/javascript">
    var loaded=0;
    setTimeout('if(!loaded){alert('you have not laoded!');}',5000/*5000ms*/);
</script>

and in the bottom of page(ie:very before tag), add

<script type="text/javascript">
    loaded=1;
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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