Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$(window).load Chrome,Safari problem

Ok here is the problem

$(window).load(function () {
        \\Do something
    });

and other variations of this just don't work in chrom and safri. FF,IE opera work fine I search but didn't find any working solution someone know how to check in chrome,safari when the page has finished loading?

like image 620
Yovo Avatar asked Sep 21 '11 00:09

Yovo


2 Answers

You can try one of the below code if you want to execute something on page load.

$(document).ready(function(){
    //Page loaded
});

OR

$(function(){
    //Page loaded
});

EDIT: Try this

window.onload = function(){
   //Page loaded
};

Or if you want to use jQuery then try this

$(window).bind('load', function(){
   //Page loaded
});
like image 117
ShankarSangoli Avatar answered Oct 15 '22 09:10

ShankarSangoli


Both window.load and document.ready work for me, here's a fiddle

like image 37
aziz punjani Avatar answered Oct 15 '22 11:10

aziz punjani