sierra101
sierra101

Reputation: 13

Check if webpage is completely loaded

I need to make a Ajax call after my webpage is completely loaded , How do i check whether my webpage is completely loaded .

Is document.ready is only solution .

Upvotes: 1

Views: 1451

Answers (2)

Prashant
Prashant

Reputation: 8060

If by completely loaded, you mean that all the resources of the page are loaded too (like images, fonts, etc.), then, window.onload is where you need to tie your handler.

If you only care about when the browser finishes constructing your DOM, you need to add the listener to DOMContentLoaded event.

Upvotes: 1

Jameel Moideen
Jameel Moideen

Reputation: 7941

If you want something similar to jQuery's document-ready event (indicating that all of the necessary references have been loaded and that the window is ready), you could probably use something like :

angular.element(document).ready(function () {
        // Your document is ready, place your code here
});

Upvotes: 0

Related Questions