Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 381
  • Last Modified:

How to prevent my site being sucked into an iFrame?

One of my WordPress web sites is being used (with my permission) by someone who has created a site that conglomerates posts belonging to a particular topic. The problem is when you click one of my story links on the guy's page, you're brought to a site that looks like my WP site, but the top 2 inches belongs to this guy.

 It's kind of like how About.com puts its header on top of sites it links to. Except that this conglomerator's "hide this header frame" link is a tiny unlabeled button.

here's an example: <http://gurusunleashed.com/15566/are-you-a-font-or-a-typeface.php>

That's an example of a blogger site that's a member of the guy's conglomeration. It works the same way for my WP site (sorry don't feel comfortable posting the link here).

Looking at the source code, it appears to me that what's driving the client sites of this guy's to appear below his own header is this bit:

<iframe id="bodyFrame" src="http://feedproxy.google.com/~r/RealWorldIllustrator/~3/PWA7YnEzrwM/are-you-font-or-typeface.html" title="Are you a &#8220;Font&#8221; or a &#8220;Typeface&#8221;?" scrolling="auto" marginwidth="0" marginheight="0" height="100%" width="100%" hspace="0" vspace="0" frameborder="0"></iframe>

I would like to edit my WP site -- add some javascript somewhere? -- so that links to any of my stories don't end up underneath someone else's header banner, this guy's or anyone's. I host my own WP blog and it's version 2.3.2. How to do that?
0
hergeekness
Asked:
hergeekness
  • 3
  • 3
1 Solution
 
Ionut A. TudorPHP ProgrammerCommented:
See below:

if ( top.location != self.location )
    {
	top.location.replace( window.location.href );
	}

Open in new window

0
 
hergeeknessAuthor Commented:
Thanks ... I'm not a scripter. I assume that code goes in my WP theme's header.php file, is that right?

The header.php file has the <head> stuff plus also <body> stuff for my own banner artwork/links, and is pulled in first by all other .php files which are part of my theme.

Any place in particular in that header.php file I should put your code? In head or in body? How do I open/close it with script tags?

thanks
0
 
Ionut A. TudorPHP ProgrammerCommented:
Yes it comes in the html header, so i guess header.php file contains the header data of your file structure. Here is code in php:

echo '<SCRIPT TYPE="text/javascript">
if ( top.location != self.location )
    {
 top.location.replace( window.location.href );
 }
</SCRIPT>';

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
hergeeknessAuthor Commented:
thanks al3cs12, I'll try it tonight and will let you know/accept solution.
0
 
Ionut A. TudorPHP ProgrammerCommented:
Thanks
0
 
Axe007Commented:
Or this website has a good explanation and 2 solutions:
http://www.sightspecific.com/~mosh/Tricks/Unframe/
0
 
hergeeknessAuthor Commented:
Hi, sorry for the wait. I haven't had a chance to try it yet but don't want to leave you hanging. (Is there a way to put a "hold" on an answer here?)

 I'll just accept your answer al3cs12 and award you the points, in appreciation for your quick response. Thanks again.

AM
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now