2012-02-01 26 views
13

khi ứng dụng canvas được nạp trong iframe không có gì là hiển thị và trên Chrome Firebug điều khiển tôi thấy lỗi:Canvas trống => 'Từ chối hiển thị tài liệu vì màn hình bị cấm bởi tùy chọn X-Frame.'

Refused to display document because display forbidden by X-Frame-Options.

Firebug Console

tôi đã cố gắng giải pháp này: Overcoming "Display forbidden by X-Frame-Options"

class ApplicationController < ActionController::Base 
protect_from_forgery 
before_filter :set_xframeoption 

def set_xframeoption 
    response.headers["X-Frame-Options"]='GOFORIT' 
end 

end 

Nhưng Tôi có lỗi tương tự. Bất kì giải pháp nào?

Cảm ơn

- FB Resquest Header - 
GET /dropis_app/ HTTP/1.1 
Host: apps.facebook.com 
Connection: keep-alive 
Cache-Control: max-age=0 
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7 
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Encoding: gzip,deflate,sdch 
Accept-Language: en-US,en;q=0.8 
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 
Cookie: [lot of stuff] 

- FB Response Header - 
HTTP/1.1 200 OK 
Cache-Control: private, no-cache, no-store, must-revalidate 
Expires: Sat, 01 Jan 2000 00:00:00 GMT 
P3P: CP="Facebook does not have a P3P policy. Learn why here: http://fb.me/p3p" 
Pragma: no-cache 
X-Content-Type-Options: nosniff 
X-Frame-Options: DENY 
X-XSS-Protection: 1; mode=block 
Set-Cookie: wd=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain=.facebook.com; httponly 
Content-Encoding: gzip 
Content-Type: text/html; charset=utf-8 
X-FB-Debug: JGyR/rXLGOKtchBAPFmyYiPZrd5npWbORZgq4sirM1Q= 
X-Cnection: close 
Transfer-Encoding: chunked 
Date: Wed, 01 Feb 2012 17:58:00 GMT 



- iFrame Request Header - 
Request URL:https://foobar.herokuapp.com/ 
Request Method:POST 
Status Code:302 Found 
Request Headersview source 
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 
Accept-Encoding:gzip,deflate,sdch 
Accept-Language:en-US,en;q=0.8 
Cache-Control:max-age=0 
Connection:keep-alive 
Content-Length:433 
Content-Type:application/x-www-form-urlencoded 
Host:dropis.herokuapp.com 
Origin:https://apps.facebook.com 
Referer:https://apps.facebook.com/foobar/ 
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7 
Form Dataview URL encoded 

- iFrame Form Data - 
signed_request: [removed] 

- iFrame Response Header - 
Response Headersview source 
Cache-Control:no-cache 
Connection:keep-alive 
Content-Length:195 
Content-Type:text/html; charset=utf-8 
Date:Thu, 02 Feb 2012 16:35:27 GMT 
Location:https://graph.facebook.com/oauth/authorize?client_id=[removed]&redirect_uri=https://foobar.herokuapp.com/users/callback 
Server:WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09) 
Set-Cookie:_dropis_static_session=[removed]; path=/; HttpOnly 
X-Rack-Cache:invalidate, pass 
X-Runtime:0.001540 
X-Ua-Compatible:IE=Edge,chrome=1 
+0

Bạn có thể gửi các tiêu đề cạnh tranh được gửi đến (aka được nhìn thấy bởi) trình duyệt? – DMCS

+1

Chắc chắn, có bạn đi. Cảm ơn @DMCS –

+0

Những hình như đó là các tiêu đề của Facebook. Làm thế nào về các tiêu đề cho nội dung iframe? – DMCS

Trả lời

9

Nếu bất cứ ai khác có vấn đề này, tôi cố định nó bằng cách thêm này để liên kết của tôi:

:target => "_top"

Điều đó làm cho nó tải các auth vào cửa sổ hàng đầu.

Từ đây:

https://developers.facebook.com/docs/authentication/canvas/

+0

Tôi gặp vấn đề tương tự và giải pháp tương tự giải pháp này đã giải quyết được vấn đề của tôi. Như được nêu trong tài liệu (tối nghĩa) facebook, bạn nên chuyển hướng người dùng đến url đăng nhập trong khung trên cùng, chứ không phải trong khung nội tuyến. Tôi đã giải quyết vấn đề này bằng cách gửi một trang trống chỉ với: '' – Mortimer

Các vấn đề liên quan