简体   繁体   中英

Ensure that a page is displayed only in an iframe

I have a page that's been displayed through an iframe as a facebook pagetab. How can I make sure that the page is displayed in an iframe as intended ?

You mean

if (top==self) location.replace("iframewrapper.html?loc="+escape(location.href))

You cannot always ensure that because your users can always fool the browser that it is what you want it to be. But you can try this:

if (window!=window.top) { /* In a frame! */ }
else { /* probably reload page and redirect to the page embedding the iframe */ }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM