When using Safari (Version 11.1 (13605.1.33.1.4)) every window event functions that I have tried are not working:
Pure JavaScript:
window.addEventListener('load', function() { // code here });
window.onload = function() { // code here };
jQuery
$(window).on('load', function() { // code here });
$(window).load(function() { // code here });
I don't want to use document ready functions, because I have to wait till all images are loaded on the page. If you have something other in mind, please feel free to discuss.
How about this?
if (document.readyState === 'complete') {
callback();
} else {
window.addEventListener('load', callback);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With