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

386
Visualizações
Js or jquery: open a url with mobile user agent

I need to open a url with a mobile user agent... similar to the inspect element setting iphone and the reloading to get the effect. Nevermind if is a window.open or a iframe, I accept every idea.

I've tried setting useragent and then reloading a window.open... but no. I've tried to get the html, setting user agent, replacing html in window.open but something is not rendered as "natural".

As for now, I am here:

let generatedSource = new XMLSerializer().serializeToString(document);

let previewWindow = window.open("about:blank", "previewMobileFrame", "width=400,height=800,resizable=0");

setUserAgent(previewWindow, 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/69.0.3497.105 Mobile/15E148 Safari/605.1');
previewWindow.document.write(generatedSource);

Or I am in open my url, change useragent, reload window.

But there are some SSI that are obviously not re-renderered... and I thing setUserAgent is not really working.

Short story: how can I emulate "inspect element and setting to iphone" of chrome, and reload in js or jquery? enter image description here

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