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

385
Vistas
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 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