Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda