我知道document.referrer
和window.location
,但是我想在这个例子中找出http://somesite.com/page
(iframe 中的 url src)将通过 console.log
或 document.body.innerHTML
告诉用户 http://whatever.com/
"iFrame is on another site"
或
"iFrame is on the main domain"
这在 JavaScript 中可能吗?
最佳答案
我发现我想做的事情是不可能的,因为 Same Origin Policy :(
关于javascript - 检查 IFrame 是否嵌入在另一个站点上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36510651/