最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Check if a page is Full loaded and rendered - Stack Overflow

programmeradmin3浏览0评论

How can i check by JS if a page has full loaded and rendered its controls?

Things like this

document.addEventListener('DOMContentLoaded', function() {
    alert('JS');
}, false);

and this

$(document).ready(function(){
    alert('JQuery');
});

Returns me when the page is loaded, but its NOT my case. My page has alot of Iframes inside, and even with the page full loaded the iframes itself arent yet.

So i need to know when the page is FULL loaded and rendered. Looks like the brownser page icon "does it" for me, since it changes when the page is done, like in example below.

Page NOT ready!

Page ready!

How can i check by JS if a page has full loaded and rendered its controls?

Things like this

document.addEventListener('DOMContentLoaded', function() {
    alert('JS');
}, false);

and this

$(document).ready(function(){
    alert('JQuery');
});

Returns me when the page is loaded, but its NOT my case. My page has alot of Iframes inside, and even with the page full loaded the iframes itself arent yet.

So i need to know when the page is FULL loaded and rendered. Looks like the brownser page icon "does it" for me, since it changes when the page is done, like in example below.

Page NOT ready!

Page ready!

Share Improve this question edited Apr 6, 2016 at 12:27 Marcel James asked Apr 6, 2016 at 12:25 Marcel JamesMarcel James 88411 silver badges22 bronze badges 1
  • $(window).load(function() return true when whole page is properly loaded. – Sumanta736 Commented Apr 6, 2016 at 12:30
Add a ment  | 

1 Answer 1

Reset to default 4

Use $(window).load(function() {}); OR window.onload = function () {}

window.onload called once all the html tags/script, images, frames are fully load.

References :-

Difference between document.ready and window.onload

DOMContentLoaded

发布评论

评论列表(0)

  1. 暂无评论