且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

拒绝显示一个框架,因为它将'X-Frame-Options'设置为'sameorigin'

更新时间:2021-07-30 15:50:58

当您发送请求时 GET POST iframe(GET)等。您的浏览器或WebView会在请求标头中添加一个标题为 原点。标题 CAN'T 可以改变它。

When you send a request like GET, POST, iframe (GET), etc. Your browser or WebView adds by deffault a header in "Request-Headers" with name "origin". That header, CAN´T be change it.

在您的情况下,我可以看到您试图嵌入的网址:https://www.***.com / embed / results?search_query = + this.myInput但是***的文档说的网址必须是:http://www.***.com/embed/ VIDEO_ID?origin = http://yourPage.com

In your case, I can see than the url you are trying to embed it´s: "https://www.***.com/embed/results?search_query= + this.myInput" but ***´s documentation say than the url must be: "http://www.***.com/embed/VIDEO_ID?origin=http://yourPage.com".

当您使用< iframe> 使用***,总是你必须在链接的参数中发送一个来源。

When you use <iframe> with ***, ALWAYS you have to send a origin in parameters of the link.


来源:
此参数为IFrame API
提供额外的安全措施,仅支持IFrame嵌入。如果您使用IFrame
API,这意味着您要将enablejsapi参数值设置为1,
您应始终将您的域指定为原始参数值。
https://developers.google.com/***/ player_parameters?hl = zh-419#origin

这里有一个文档de ***的链接: https://developers.google.com/***/player_parameters?hl=en-419

Here you have a link to documentation de ***: https://developers.google.com/***/player_parameters?hl=en-419

问候!