我有一个页面通过iframe显示为facebook pagetab。如何确保页面按预期显示在iframe中?
答案 0 :(得分:3)
你的意思是
if(top == self)location.replace(“iframewrapper.html?loc =”+ escape(location.href))
答案 1 :(得分:1)
您无法始终确保这一点,因为您的用户始终可以欺骗浏览器,使其符合您的要求。但你可以试试这个:
if (window!=window.top) { /* In a frame! */ }
else { /* probably reload page and redirect to the page embedding the iframe */ }