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

111
Visualizações
How to open browser window in iframe using JavaScript

I want to open a application within iframe. I am using below script to do it. But, I am not able to open it within iframe.

Can someone help me to figure out how to open it in in iframe.

I have tried searching for the solution but could not find.

I have provided the complete JavaScript code in here.

I tried following code.

@{   
    string Url = ViewBag.Url;
    string Token = ViewBag.Token;
    string Response = ViewBag.Response;
}

<br />
<div id='signal'>
    <center><img src="~/images/gears.gif" /></center>   
</div>

<iframe src="@Url"></iframe>

<div id="output"></div>
<div id="divBackground"></div>

JavaScript

$(document).ready(function() {
  $.ajax({
    url: '@Url'.replace(/amp;/g, ''),
    type: 'GET',
    beforeSend: function(xhr) {
      xhr.setRequestHeader('Authorization', 'Bearer ' + '@Token');
    },
    success: function(data) {
      var params = [
        'height=' + screen.height,
        'width=' + screen.width
      ].join(',');

      var popUp;

      function showModal() {
        const iframe = document.createElement('iframe');

        iframe.src = '@Url';

        document.body.appendChild(iframe);

        //popUp = window.open("", "_blank", params);
        popUp.location.href = data.message;

        popUp.focus();
        LoadModal();
      }

      function LoadModal() {
        var bkg = document.getElementById("divBackground");
        bkg.style.display = "block";
      }

      function OnUnload() {
        if (false == popUp.closed) {
          popUp.close();
        }
      }

      window.onunload = OnUnload;

      showModal();
    },
    statusCode: {
      400: function() {
        alert("server returned a bad request response.");
      }
    },
    complete: function() {
      $("#signal").hide();
    }
  });
});
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