Search code examples
angularipadsafari

iPad' Safari 10 doesn't load Angular 5 app (works on Safari 11)


I am deploying a SPA build with Angular 5. I tested on Windows all latest versions of browsers(ie, chrome, firefox, edge), and also on a Safari on Mac.

I cannot get it to work on Safari 10.

Below the debug message that I manage to extract when connecting iPad's Safari onto Mac's Safari Inspector. ⇓ ⇓ ⇓ ⇓


Solution

  • There's a great polyfill by nothing less than Mr Paul Irish, and it did the trick just fine. It's related over here, and I have to say it's a bit old, but nonetheless technically enough: https://gist.github.com/paulirish/1579671

    So just to be clear, I posted it on my index.html, as a essential script for loading on (unfortunately) every browser and etc.

    (function() {
    
        var lastTime = 0;
    
        var vendors = ['ms', 'moz', 'webkit', 'o'];
    
        for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
    
            window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
    
            window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] 
    
                                       || window[vendors[x]+'CancelRequestAnimationFrame'];
    
        }
    
    
    
        if (!window.requestAnimationFrame)
    
            window.requestAnimationFrame = function(callback, element) {
    
                var currTime = new Date().getTime();
    
                var timeToCall = Math.max(0, 16 - (currTime - lastTime));
    
                var id = window.setTimeout(function() { callback(currTime + timeToCall); }, 
    
                  timeToCall);
    
                lastTime = currTime + timeToCall;
    
                return id;
    
            };
    
    
    
        if (!window.cancelAnimationFrame)
    
            window.cancelAnimationFrame = function(id) {
    
                clearTimeout(id);
    
            };
    
    }());