3

I recently updated my phone to iOS 8 and now I am experiencing really unusual behavior.

Here is a demo of the problem:

<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
alert("A");
jQuery(window).load(function(){
    alert("B"); 
});
</script>

In Safari iOS 7, this brings up the dialog boxes "A" and "B". But when viewed in Safari iOS 8, only dialog box "A" shows up.

Any ideas on why window load would not be working in iOS 8?

2 Answers2

1

I don't have a real solution for this, but if you have any or in your page, Safari on iOs8 do not trigger the load event.

So you have at least 2 solutions:

  • count your externals files like images, css, scripts and attach a load event on them and wait for the last .load of those files
  • write your tag video/audio after the load events

//EDIT: So I write this that helped me to still use video:

var $video = $('.player');
$video.each(function(){
    this.outerHTML = this.outerHTML.replace('div', 'video')
});
$video = $('.player');

See Browser compatibility here to see if outerHTML fits with your compatibility https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML#Browser_compatibility

romuleald
  • 1,406
  • 16
  • 31
0

Use window.onload = function(){ }; on the behalf of jQuery(window).load(function(){ }); I am able to fix this issue on my project.

ADSingh
  • 1
  • 1