Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

203
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda