Refused to display 'url' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'

后端 未结 6 784
既然无缘
既然无缘 2020-12-08 00:31

Screenshot of t

相关标签:
6条回答
  • 2020-12-08 00:37

    I faced the same error when displaying YouTube links. For example: https://www.youtube.com/watch?v=8WkuChVeL0s

    I replaced watch?v= with embed/ so the valid link will be: https://www.youtube.com/embed/8WkuChVeL0s

    It works well.

    Try to apply the same rule on your case.

    0 讨论(0)
  • 2020-12-08 00:37

    I came across the same problem using a Wordpress page and plugin. This didn't work for the iframe plugin

    [iframe src="https://itunes.apple.com/gb/app/witch-hunt/id896152730#?platform=iphone"]
    

    but this does:

    [iframe src="https://itunes.apple.com/gb/app/witch-hunt/id896152730"  width="100%" height="480" ]
    

    As you see, I just left off the #?platform=iphone part in the end.

    0 讨论(0)
  • 2020-12-08 00:44

    You cannot display a lot of websites inside an iFrame. Reason being that they send an "X-Frame-Options: SAMEORIGIN" response header. This option prevents the browser from displaying iFrames that are not hosted on the same domain as the parent page. This is a security feature to prevent click-jacking. Some details at How to show google.com in an iframe?

    This could be of some help : https://www.maketecheasier.com/create-survey-form-with-google-docs/

    0 讨论(0)
  • 2020-12-08 00:44

    I was facing this issue in Grafana and all I had to do was go to the config file and change allow_embedding to true and restart the server :)

    0 讨论(0)
  • 2020-12-08 00:44

    This happens because of your application does not allow to append iframe from origin other than your application domain.

    If your application have web.config then add the following tag in web.config

    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <add name="X-Frame-Options" value="ALLOW" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
    

    This will allow application to append iframe from other origin also. You can also use the following value for X-Frame-Option

    X-FRAME-OPTIONS: ALLOW-FROM https://example.com/ 
    
    0 讨论(0)
  • 2020-12-08 00:48

    I think You are trying to use the normal URL of video Like this :

    Copying Direct URL from YouTube

    That doesn't let you display the content on other domains.To Tackle this up , You should use the Copy Embed Code feature provided by the YouTube itself .Like this :

    Copy Embed Code ( YouTube )

    That would free you up from any issues .

    For the above Scenario :

    • Go to Youtube Video

    • Copy Embed Code

    • Paste that into your Code ( Make sure you Escape all the " ( Inverted Commas) by \" .
    0 讨论(0)
提交回复
热议问题