Tuesday, July 31, 2012

Check if the page is in iframe

There is a common requirement while developing iframe based web application i.e. redirect if the page is not in iframe or redirect main page to login page or any default page if the page is not opened with in iframe.
In such case; if some one tries to open page using URL; we need to check if the page is in iframe or not, if it is not in iframe we have to perform desired action. 
We can use following javascript to perform this checking and if the page is not in iframe redirect it to default page.

Submit this story to DotNetKicks

0 comments: