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

289
Views
Print webpage url using window.print() html

I've been attempting to download a webpage directly using window.print() but it seems to skip the print window part. It does open the desired url, but refuse to load on the pdf print window and immediately closes the print window. Here's my code:

const onPrint = () => {
  const url = "https://www.google.com";
  window.open(url)?.print();
}

<a onClick={() => onPrint()}>Click me to download</a>

I also tried to use iframe but it says "google.com refused to connect", I'm aware that sites like Google, Yahoo, etc. won't allow iframes. I'm thinking of auto start download as it get to the external webpage but I'm not sure what should I do..

P/S: I'm using Reactjs to develop my webapp.

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!