PDA

View Full Version : Check if in frames...


dagaffer
12-14-2002, 06:29 PM
Hey all,
I was just wondering if you can tell if your webpage is being viewed through a frame? I know this can be done in Javascript but this would fit nicely into a script if it could be done in asp.

Thanx, Gaffer:thumbsup:

scroots
12-14-2002, 07:40 PM
you can run javascript in your ASP pages either at the server or at the client side.

scroots

glenngv
12-16-2002, 02:58 AM
But you can only detect the client's window properties using client-side javascript which runs on the client not on the server. Therefore, it can't be done in ASP.

jeremywatco
12-16-2002, 03:41 PM
To test if in frames using javascript you can probably use the following:

<SCRIPT LANGUAGE="JavaScript">
<!--//
if (self != top) if ( top.frames[1].name !="mainarea") {

Something

}
ELSE{

Some code. This is where you will put statments when you are IN frames.

}

</SCRIPT>