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

175
Visualizações
Adapt iframe src from embedded javascript

I have the following code, which I use to embed an iframe and I need to remove a part of the resulting embedded iframe src URL.

Here is the javascript code which generates the HTML

<script src="https://booking-widget.phorestcdn.com/obwidget.bundle.js"></script> 
<script>
  window.widget = new OBWidget('colindemonew11')
</script>

This generates an iframe with the following code:

<iframe src="https://phorest.com/book/salons//colindemonew11?utm_source=booking_widget" frameborder="0" scrolling="yes" style="width: 100%; height: 100%;"></iframe>

I'm hoping to be able to change the javascript before it executes, so instead of accessing

https://phorest.com/book/salons//colindemonew11?utm_source=booking_widget

Instead this url is used:

https://phorest.com/book/salons//colindemonew11?utm_source=[MY_PARAMS_GO_HERE]

Basically, I would like to replace the params in the URL being used, or communicate these params to the iframe in some way.

One thing I'm having trouble with is that the there is no ID or class name for the iframe, so I guess I'm going to have to select the firs iframe? e.g. iframe[0] or another way could be to check for the DIV to make sure the iframe is inside it. I guess I could use this:

document.getElementsByTagName('iframe')[0]

However, I'm not sure how to limit it to be inside the div which is produced:

<div class="ob-widget-container-frame-container"><iframe src="https://phorest.com/book/salons//colindemonew11?utm_source=booking_widget" frameborder="0" scrolling="yes" style="width: 100%; height: 100%;"></iframe></div>

I'm wondering if it is possible to do this by changing the javascript before it is loaded? Would be grateful if this is possible to find out how it could be achieved.

Another way is to send the params using postMessage. However, this seems a little complicated and hard to find a way of doing it for this use case.

Any suggestions are much appreciated.

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