Navigate back to the homepage

refused to display 'url' in a frame because it set 'x-frame-options' to 'sameorigin'

Infinitbility
Apache
March 31st, 2021 · 1 min read
refused to display 'url' in a frame because it set 'x-frame-options' to 'sameorigin'

Hello Friends 👋,

Welcome To Infinitbility! ❤️

The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame>, <iframe>, <embed> or <object>. Sites can use this to avoid click-jacking attacks, by ensuring that their content is not embedded into other sites.

The added security is provided only if the user accessing the document is using a browser that supports X-Frame-Options.

You are trying to embed video or show pdf in your website and getting error like below

refused to display ‘url’ in a frame because it set ‘x-frame-options’ to ‘sameorigin’

well solution depends upon which url want show in your website.

Youtube url

when trying show youtube video on your website then you have to remove watch?v= with embed/

For example: https://www.youtube.com/watch?v=8WkuChVeL0s to https://www.youtube.com/embed/8WkuChVeL0s

It works well.

Apache server url ( your server )

when your node, php, and backend language using apache server then you have to set header like below example

Go to your your conf available folder

1$ cd /etc/apache2/conf-available

Edit default-ssl.conf or your domain conf virtualhost

Add header with “SAMEORIGIN”

1Header always set X-Frame-Options "SAMEORIGIN"

when your diffrent origin

1Header always set X-Frame-Options "ALLOW-FROM https://clientsidedomain.com/"

Thanks for Reading…

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

More articles from Infinitbility

How to select and upload video in react native

How to select and upload video in react native

Example of select and upload video in react native

March 27th, 2021 · 1 min read
Network request failed in react native fetch

Network request failed in react native fetch

Solve HTTP and HTTPS Network request failed issue in react native fetch

March 15th, 2021 · 1 min read
© 2020–2021 Infinitbility
Disclaimer
Link to $https://medium.com/infinitbilityLink to $https://www.facebook.com/InfinitbilityLink to $https://github.com/infinitbilityLink to $https://twitter.com/infinitbilityLink to $https://www.buymeacoffee.com/infinitbilityLink to $mailto:[email protected]