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

173
Views
How to display a website in a reactjs application using iframe?

I created a website that allows requests from any domain that I deployed to heroku. So I'm looking to display it in my reactjs application. For this, I created a button whose click triggers the display of this site in my application via iframe. Here is my button code:

<Button
        component={NavLink}
        activeClassName={classes.activeBtn}
        to="/searchEngine"
        className={classes.buttonItemMiddle}
      >
        {location.pathname == '/searchEngine' ? (
          <Home fontSize="large" style={{ color: 'rgb(0,133,243)' }} />
        ) : (
          <HomeOutlined fontSize="large" />
        )}
      </Button> 

and I added these lines of code in my frontend App.js file:

<Route path='/searchEngine' component={() => { 
                          <iframe src="https://gkwhelps.herokuapp.com" title="Search engine"></iframe>
                          return null;
                          }}/>

It did create a button, but every time I click on it, I get redirected to localhost:3000/searchEngine (my frontend running on port 3000) and it shows a blank area where the iframe content should be displayed.According to me, my code is correct so I don't understand why this error. I thought it was a cors error, so I disabled it using an extension. But despite this, my react app still reacts the same. I want to specify that no request is sent to the backend of my application and that all the code of the iframe is present in the frontend

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!