Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
Getting Fetch/XMLHttpRequest API cannot load blob:url due to access control checks while making request from WKwebview

So, To download images/pdf that have blob: url in wkwebview, i injected javascript to my code.Here's the javaScript:

function(url) {   
        function blobToBase64String(blob, callback) {
            var reader = new FileReader();
            reader.onloadend = function() {
                callback(this.result.split(",")[1]);
            };
            
            reader.readAsDataURL(blob);
        }
        if (url.startsWith("blob:")) {
             var xhr = new XMLHttpRequest();
             xhr.open("GET", url, true);
             
            
            xhr.responseType = "blob";
            xhr.onload = function() {
                if (this.status !== 200) {
                    return;
                }
                
                var blob = this.response;
              
                
                blobToBase64String(blob, function(base64String) {
                    webkit.messageHandlers.downloadManager.postMessage({
                    url: url,
                    mimeType: blob.type,
                    size: blob.size,
                    base64String: base64String
                    });
                });
            };
            
            xhr.send();
            return;
        }
        
        var link = document.createElement("a");
        link.href = url;
        link.dispatchEvent(new MouseEvent("click"));} 

This is the error i m getting: XMLHttpRequest cannot load blob:https://url due to access control checks. Is there any way to allow request in wkwebview. I m not sure, where to head forward! Is there any preferences in wkwebview, that needs to be enabled?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!