Click here to Skip to main content
15,909,325 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How can i prevent my page opening on an iframe ???
is their any techniques exist in asp.net server side
or i have to control it through client side using javascript,jquery etc?
if on client side or server side then how to do it ???

actually what i want that nobody can open my webpage on <iframe src="mywebpagesource">
such as we often opens other webpages of some other web sites by using iframe tag
i just want to prevent it that no-one can open my website page by using <iframe> tag



thanx in advnace ....
Posted
Updated 24-Jun-13 21:01pm
v2

can you brief this...
so i can help you..
 
Share this answer
 
Comments
sajid zafar_Iqbal 25-Jun-13 2:58am    
thanx for reviewing and commenting actually what i want that nobody can open my webpage on <iframe src"mywebpagesource">
such as we often opens other webpages of some other web sites by using iframe tag
i just want to prevent it that no-one can open my website page by using <iframe> tag
you can use this on your home page. with onload event.


if(self != top) { top.location = self.location; }
 
Share this answer
 
Comments
sajid zafar_Iqbal 25-Jun-13 3:27am    
$(document).ready(function () {
//code (prevent page to open on an iframe)
if (self != top) {
top.location = self.location;

}

i have implemented this code on my web application
and then opens that page on some other application by using <iframe src"mypagesource"> and it still opens there
mkbisht 25-Jun-13 4:39am    
use onload event not ready().

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900