Hi there forum,
I'm having an issue with the following javascript xhr request only in iOS 14 (it works in iOS 13 and lower):
let script = """
var xhr = new XMLHttpRequest();
xhr.open('GET', '\(absoluteUrl)', true);
xhr.responseType = 'blob';
xhr.onload = function(e) {
if (this.status == 200) {
var blob = this.response;
var reader = new window.FileReader();
reader.readAsDataURL(blob);
reader.onloadend = function() { window.webkit.messageHandlers.readBlob.postMessage(reader.result);
}
}
};
xhr.onerror = function(e) {
console.log(e.target)
}
xhr.send();
"""
self.webView.evaluateJavaScript(script, completionHandler: nil);
The absoulteUrl in question here looks like this: blob:http://{my-host-domain}/1cbb6855-2402-4411-adc7-f889cdd5b78a
This blob is always on the same domain that I am navigating to but I've also tried adding app-bound domains to no avail.
Is there something about iOS 14 that would make this script break?