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

295
Vistas
Get cookie of parent page (iframe) using JS

I need to get a cookie created in parent page.

enter image description here

I need get a spesific cookie (example) who was cread on modiface--locatelcolomia.myvtex.com and used this on my child page modiface.locatelcolobmia.com (this one is called by vtex iframe)

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

0

Thanks for the help, this is the answer: I got the cookie by Jquery and save on a input type hidden at the end send to my iframe calling a php page and send this value by URL (GET).

jQUERY

let cartId = $('#idCartInput').val();

IFRAME

("#idCartBtn").html("<iframe src='http://localhost:81/projectExample/modiface/index.php?cartId="+cartId+"' class='frameModiface' id='pruebasId' allow='camera' name='iframe_a'></iframe>");
about 4 years ago · Juan Pablo Isaza Denunciar

0

You cannot directly get cookies from other pages.

You can send a request to that page to send the cookies.

getCookies.php (put on parent page)

window.onload = function(){document.getElementById('submitpost').submit();}
<?php if(!isset($_COOKIE['COOKIE_NAME_HERE']) {die('set cookie');} ?>

<h3>Please wait</h3>

<form id="submitpost" action="PUT_PREVIOUS_PAGE_URL_HERE" method="post">
  <input type="hidden" name="cookie" value="<?php echo $_COOKIE['COOKIE_NAME_HERE']; ?>">
</form>

Then set the cookie to that. Redirect users without the set cookie to the getCookies.php page.

This form can be intercepted and changed, but cookies can as well. Never put account details in cookies.

This answer requires a web server with PHP, chances are that your host does support PHP.

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