Avatar of CPSRI
CPSRIFlag for United States of America

asked on 

access the url of the iframe/frame/frameset from its src

Hi,
I want to prevent un-authorized forwards to my domain, i noticed that some people are redirecting their websites to my website using frame/iframe/frameset. How can I prevent that? I can program in asp.net, asp..any ideas..

Thanks in advance.
ASP.NETASPHTML

Avatar of undefined
Last Comment
CPSRI
Avatar of sammySeltzer
sammySeltzer
Flag of United States of America image

Use frame-busting code similar to this:

if(top != self)
   {  
      window.open(location.href, '_top');  
   }

The use of  _top as the target parameter for window.open() will launch it in the same window.

There are other ways to do this but this is the easiest to me.
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

I you are just trying to prevent the pages from being framed then just add this script to the pages being framed.

<script language="Javascript">
<!--
if (top.location != self.location) {
top.location = self.location.href
}

//-->
</script>

Cd&
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of CPSRI
CPSRI
Flag of United States of America image

ASKER

THank you so much..
ASP.NET
ASP.NET

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

128K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo