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

169
Views
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 answers
Answer question

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 Report
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!