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

156
Visualizações
How to modify <object> data attribute for Google Chrome?

I am trying to change the data attribute of an element with id 'previewImage'. I modify the attribute by doing an Ajax call to another file, and get back the data. All browsers shows the data received from the AJAX-call (image or PDF) (encoded base64), except Google Chrome. Is there an solution for this?

I saw this answer earlier, but I think it is deprecated (it did not work for me): <object> works in every browser except Google Chrome

Ajax Call:

function getFile(id, r = false)
{
    timer = setTimeout(function(){
        $.ajax({
            url: "/project/getFile",
            method: "POST",
            data: {id: id}
        })
            .done(function(data)
            {
                $('#previewImage').prop('data', data);
            })
    }, 100)
}

object:

<object id="previewImage" class="w-100" style="min-height: 500px">
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Thanks for the help everyone! I changed the object tag to an Iframe, witch made the following:

<iframe id="previewImage" class="w-100" height="500px"></iframe>

The AJAX-call stayed almost the same:

function getFile(id, r = false)
    {
        timer = setTimeout(function(){
            $.ajax({
                url: "/project/getFile",
                method: "POST",
                data: {id: id}
            })
                .done(function(data)
                {
                    $('#previewImage').prop('src', data);
                    $('#previewImage image').css("width: 100%")
                })
        }, 100)
    }

This worked for me!

about 4 years ago · Juan Pablo Isaza Relatório
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