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

162
Vistas
Why is iframe source code than the source code of file?

I want to load a file into an iframe, then save it out to a file. Right now, just trying in javascript, but would prefer to use Blazor. Maybe it has newer ways to do it?

Anyway, the source code seems to change a little from the file, but I don't want this as I want to save it out exactly the same as the source. For example, here is some code in the file being loaded into the frame:

<!DOCTYPE html>
<!--[if lt IE 9]>
<html class="no-js lt-ie9" lang="en" dir="ltr">
<![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en" dir="ltr">
<!--<![endif]-->
<html>

<head>

...and if I load the outerHTML into a textarea to see what would be saved, it is just:

<html><head>

So ya, any way to get the source from the iframe exactly how it is in the source file? By the way, here is how I currently get the source from the frame into the textarea:

<a href="#" onclick="getIframeContent('myI');">
    Get the content of Iframe
</a>

<br />

<textarea id="txtarea" style="width:100%;height:300px"></textarea>
<br>

<iframe id="myI" src="myPage.html" style="width: 100%; height: 100vh;"></iframe>

    <script>
        function getIframeContent(myI) {
            var frameObj = document.getElementById(myI);
            var frameContent = frameObj.contentWindow.document.documentElement.outerHTML;
            txtarea.value = frameContent;
        }
    </script>
about 4 years ago · Juan Pablo Isaza
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