From the server is there a way to know that my pag

2019-02-28 05:56发布

I am using sammy.js in my webpage, and if someone uses this webpage in an IFrame (for IE), it will simply redirect the whole page to the location of the IFrame.So, I was thinking if there is a way to check if my page is being requested by an IFrame.If that is the case, then I can simply disable sammy(change lines that play with top.location).

I was thinking that a browser would be sending a few more headers , when a page is loaded in an IFrame.

1条回答
叛逆
2楼-- · 2019-02-28 05:58

You can do this using javascript with the following code:

if (window!=window.top) { /* I'm in a frame! */ }

To the best of my knowledge, though, there is no way to find this out serverside, as the browser merely sends an http request like it always would. You can try just dumping all of the headers to see if there's any discernible difference, but I really doubt it.

查看更多
登录 后发表回答