2013-04-11 58 views
2

我正在嘗試使用來自Linkedin的連接API。當我使用撥打電話時,它返回一個錯誤:請求訪問的幀的協議爲'https',被訪問的幀的Linkedin的協議爲'http'

Unsafe JavaScript attempt to access frame with URL http://www.*example*.com/ from frame with URL https://api.linkedin.com/uas/js/xdrpc.html?v=0.0.2000-RC1.26335-1404#www.*example*.com&xdm_c=default4901&xdm_p=1&mode=cors. The frame requesting access has a protocol of 'https', the frame being accessed has a protocol of 'http'. Protocols must match. 

任何人都知道爲什麼會發生此錯誤?

非常感謝您的幫助!

+0

我認爲它說,使用JavaScript調用API LinkedIn的頁面有一個http:// URL,但它應該是https://開頭,不是嗎? – piokuc 2013-04-11 16:30:07

+1

錯誤提示「父頁面和iframe都需要使用相同的協議。」意味着他們都必須是http或https。你不能混用它們。 – epascarello 2013-04-11 16:44:11

+0

你在使用Ajax調用,還是在嵌入Iframe? – ShaunOReilly 2013-04-12 01:40:40

回答

0

它與http/https位無關。

添加「& callback =?」到你打電話的URL,它會做一些魔術!

喜歡這個!

var url = "https://api.instagram.com/v1/users/" + id + "?access_token=" + instagramtoken + + "&callback=?" 

看到這個解決方案的某處在stackoverlfow,但cannor記住在哪裏。它解決了我的問題!

心連心