Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

383
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!