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

112
Visualizações
calling child url from parent page

I will need to call child url from parent url. Both are having different host . test.html is stored in the server, www.web1.com will load test.html and display this on www.prod.com

I am trying to capture the url that is showing from website1[www.web1.com] on website2[www.prod.com]

Flow is as shown below

enter image description here

  • server and website1 are linked and are using the same host hence there will be no issue

inside test.html , i have used console.log(window.top.location.href) , this will display "www.web1.com" on my console.log

on www.prod.com , it will load www.web1.com which consist of test.html , when window.top.location.href script that was declared in test.html and place in web 1 is loaded in website 2, this will cause DOMException cross origin error because the script is reading www.prod.com instead of www.web1.com. I have read through some source to use document.referrer , i am wondering if this is possible for web 2 to display "www.web1.com" on console.log when it loads web 1 on web 2

ideally , if we use window.location, this will load the top url of web ,

  1. if this is used on web1 , it will print www.web1.com
  2. if this is used on web2 , it will print www.prod.com

But as for the usecase i stated above, web2 should load and display web1 url on web2 console.log

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