Quiero abrir una aplicación dentro de iframe. Estoy usando el siguiente script para hacerlo. Pero no puedo abrirlo dentro de iframe.
¿Puede alguien ayudarme a descubrir cómo abrirlo en iframe ?
He intentado buscar la solución pero no la encuentro.
He proporcionado el código JavaScript completo aquí.
Intenté seguir el código.
@{ 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(); } }); });