1

I am implementing React IFrame in React JS using react-iframe .

When I run it on my localhost server then it says

Refused to display 'https://www.facebook.com/' in a frame because it set 'X-Frame-Options' to 'deny'.

Below is my code I have written.

import React from "react";

import Iframe from 'react-iframe'

export default function IFrameComponent() {

    return(
        <Iframe url="https://www.facebook.com/"
        width="450px"
        height="450px"
        id="myId"
        className="myClassname"
        display="initial"
        position="relative"/>
    )

}

Any Help would be great.

Thank You.

Brijesh Patel
  • 157
  • 1
  • 4
  • 15

1 Answers1

0

I've seen an answer right here that will help you How to set 'X-Frame-Options' on iframe?

in short : This is not an issue with the package, it's because the owner of the webpage you are trying to display in the frame has configured its settings specifically to disallow usage in iframes. Unfortunately, you will not be able to pull in that URL without the site owner's permission.

Eyal Delarea
  • 141
  • 1
  • 11