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

113
Vistas
How to read a variable declared in a html file inline script to another html inline script

I have two html files e.g. abc.html & rst.html. abc.html has inline script having a variable x declared inside it with some value. Now I want to access the x value inside rst.html file's inline script. Could you please let me know if this is possible.

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

0

You can't.

JavaScript does not let you access other tabs (to some extend, you may be able to access <iframes>s which could be in a separate window, but that's it and newer browsers generally prevent such accesses).

While in your browser, you have access to one set of global variables that are in that one window. Anything else is not accessible for security reasons.

The only way you would be able to do that is by using AJAX to read the second file and then search for the variable and grab the value. Good luck doing that...

The simplest for you will be to create a file, say x.js, and load that in both HTML pages. Now you will have access to all the data found in x.js.

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