我正在尝试从我的网站www.drewgl.com添加一些页面到stumbleupon。它非常依赖于javascript。当我通过stumbleupon查看我的站点时,javascript就会被阻塞。具体来说,我看到了错误:
Uncaught :阻止原名为"http://www.drewgl.com“的帧访问原名为"http://www.stumbleupon.com”的帧。协议、域和端口必须匹配
我使用部署到heroku的rails 4。我把我的X帧选项设置为允许所有。我在这里阅读了答案:SecurityError: Blocked a frame with origin from accessing a cross-origin frame,似乎解决这个问题的唯一方法是使用window.postmessage在两个页面之间发送消息。但是,要做到这一点,您必须同时拥有两个页面。
当然,这个条件不能满足Stumbleupon的要求,所以我怎样才能回避这个问题呢?
编辑:我刚刚下载了用于chrome的stumbleupon工具栏。完成此操作后,我将不再收到上述错误消息。无论哪种方式,我仍然想为没有工具栏的绊脚石修复这个问题。
发布于 2016-08-01 19:53:06
弄明白了。如果有人好奇,您不允许从iframe中访问当前路径。这段代码导致了以下问题:
// if (top.location.pathname === '/users/sign_in')
// {
// $('#login').modal('show');
// }发布于 2017-05-13 19:44:35
Rails应用程序没有在StumbleUpon上加载?将此添加到ApplicationController中
before_action :allow_iframe_requests
private
def allow_iframe_requests
response.headers.delete('X-Frame-Options')
endhttps://stackoverflow.com/questions/38676608
复制相似问题