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

195
Visualizações
Issue with window.replace() method having search params in URL

I m trying to open a new window from my web page while clicking on the 'number#' lsted in my page, actually, it's a google search(eg: https://www.google.com/search?q=12312), and got the results in the new tab

I am also trying to replace the search query parameter again while clicking on another Number#(eg: https://www.google.com/search?q=456456), But replace functionality not working. Below I am placed the demo code

let win;
let firstSearch = () => {
    win = window.open('https://www.google.com/search?q=123123', '_blank');
}

let secondSearch = () => {
    win.location.replace('https://www.google.com/search?q=345345')
}

But its not working. But I remove '/search' from the URL replacement is happen. So, any solution for this search and replacement parameters

Codepen

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

That is not working because the site tells the browser that they don't want to be loaded in X-Frame. That's why your code works using Bing but not Google...

from: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options

The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame>, <iframe>, <embed> or <object>. Sites can use this to avoid click-jacking attacks, by ensuring that their content is not embedded into other sites.

about 4 years ago · Juan Pablo Isaza Relatório
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