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

168
Vistas
Sync issue with iframe in Chrome and Edge

the following script is used to load in a IFRAME a web application.

          function openCashier(destination) {
                postIsAnonymous(function (data) {
                    if (data.IsAnonymous) {
                        window.parent.location.replace('<%= ResolveUrl("~/Popup/login") %>');
                    } else {
                        stateReset('showUserBtn');
                        WCore.OpenTab('cashier');
                        $("#cashierPopup").addClass(destination);
                        $("#cashierFrame").attr('src', '<%= ResolveUrl(Routing.GetUrl("Root-TPAutologin")) %>?Destinazione=' + destination);
                    }
                });
             }

In Firefox everything works fine, while in Edge and Chrome I get error 404. If I try to load the contents of the IFRAME in a separate browser session everything works. I tried to edit the javascript as follows, fearing an asynchronism problem:

            function openCashier(destination) {
                setTimeout(function () {
                    postIsAnonymous(function (data) {
                        if (data.IsAnonymous) {
                            window.parent.location.replace('<%= ResolveUrl("~/Popup/login") %>');
                    } else {
                        stateReset('showUserBtn');
                        WCore.OpenTab('cashier');
                        $("#cashierPopup").addClass(destination);
                            $("#cashierFrame").attr('src', '<%= ResolveUrl(Routing.GetUrl("Root-TPAutologin")) %>?Destinazione=' + destination);
                        }
                    });
                }, 1000 * 20);
             }

With this trick the problem is solved with very bad performances.

PostIsAnonymous code is the following :

function postIsAnonymous(successFunc) {
  $.ajax({
    type: "POST",
    url: '?checkIsAnonymous=1',
    cache: false,
    contentType: "application/x-www-form-urlencoded;charset=ISO-8859-15",
    processData: false,
    success: successFunc
  });
}

Do you have any suggestions to give me to solve the problem in a more elegant way? Thank you

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I solved the problem with the following code.

 function openCashier(destination) {
                var dest = destination;
                sessionManager.isAnonymous()
                    .then((data) => {
                        if (data.IsAnonymous) {
                            window.parent.location.replace('<%= ResolveUrl("~/Popup/login") %>');
                        }
                        else {
                            stateReset('showUserBtn');
                            WCore.OpenTab('cashier');
                            $("#cashierPopup").addClass(dest);
                            $("#cashierFrame").attr('src', '<%= ResolveUrl(Routing.GetUrl("Root-TPAutologin")) %>?Destinazione=' + dest);
                        }
                    })
                    .catch((err) => {
                        console.error(err);
                    });
            }

 var sessionManager = {
    isAnonymous: () => {
    return new Promise((resolve, reject) => {
        $.ajax({
            type: "POST",
            url: '?checkIsAnonymous=1',
            cache: false,
            contentType: "application/x-www-form-urlencoded;charset=ISO-8859-15",
            processData: false,
            success: function (data) {
                resolve(data);
            },
            error: function (data) {
                reject(data);
            }
        });
    })
   }
 }
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