Allow to display my wordpress site in an iframe on another site

Asked

Viewed 1,358 times

4

Hello, I have a wordpress site that would like to show one of the pages in an iframe on another site, is it possible to do this? At the moment doing the iframe on another page seems to me the following error:

"Refused to display 'https://meusite.pt/pagina_a_ser_renderizada' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'."

I don’t know where to turn off the X-Frame-option option.

Someone can give me a light?

Thank you

  • can you say why you use iframe ? why not redirect to the page you want to display?

1 answer

1


X-Frame-Options

X-Frame-Options is used to tell the browser whether or not it is authorized to process a page in a frame, iframe, or Object.

The three possible directives for X-Frame-Options are:

  • X-Frame-Options: DENY
  • X-Frame-Options: SAMEORIGIN
  • X-Frame-Options: ALLOW-FROM-the-site-origin url

DENY: Page cannot be displayed in a frame.

SAMEORIGIN: The page can be displayed in a frame but the origin should be the site itself.

ALLOW-FROM Uri: The page can be displayed in a frame if the source is specified.

Anyway, in order for you to succeed in displaying the content of another site in an iframe you must change the directive to:

ALLOW-FROM https://meusite.pt/pagina_a_ser_renderizada

Probably the current option should be set to X-Frame-Options: SAMEORIGIN

This option can be set on your web server or in the header of the page where you want to display or not iframe.

Examples:

Tag Header: x-frame-options: ALLOW-FROM url-do-site-origin

Apache: add to httpd.conf: header Always set x-frame-options "ALLOW-FROM url-do-site-origin"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.