This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术讨论 / Got into an interesting scenarios..how to detect if a page under iframe from server side (asp.net)? Your suggestion would be appreciated. .Thanks.A page can use inside the iframe, also can use in stand alone page. But it will display differently under two. The problem is how to detect it if is under iframe, possible? thanks.
-sunday8(sunday8);
2008-9-22
{180}
(#4708097@0)
-
I am not sure whether I understood your question. For server side, you can pass additional parameter to tell the page how it will be displayed; on client side, you can use window.frameElement to check whether it is in a frame.
-liquid(豆泡松果 之 松果豆泡);
2008-9-22
(#4708468@0)
-
you are right. but the problem getting nasty since the parameter needs to be propagated in all links on all the pages after. not seem like a clean solution.
-sunday8(sunday8);
2008-9-22
(#4708586@0)
-
Do you have to use one common page (actually it’s not common.) for both purposes?
-deep_blue(BLUE);
2008-9-22
(#4710058@0)
-
create a new page, and put this page before the page you working on, see code ...Code for first page
<html><body>
<script type="text/javascript">
var quirksMode = (top == self);
if( !quirksMode)
{ // page in frame
window.location = 'next.aspx?inframe=1';
}
else
{
window.location = 'next.aspx?inframe=0';
}
-dzhu(Daniel);
2008-9-23
{247}
(#4712270@0)
-
great.. i think you solved my problem.. thx.
-sunday8(sunday8);
2008-9-25
(#4719763@0)