1,105,310 Community Members

Iframe & Search Engines

Member Avatar
ivanyeates
Newbie Poster
3 posts since Aug 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi,
I've done a search and came up with nothing.
Here's my problem, I have a site that uses an index.htm page as the homepage and an iframe contained in that page that is dynamic and is the only content that changes.

Everything works fine except in web search engines, my iframe pages are coming up as results(They need the navy background from the index.htm page to see the white text)ie. i only want the index.htm page to show up. i have meta tagtrying to stop the crawling of these pages by the search engines band robots.txt in the web folder on the server but this isint stopping them being indexed.

So what i need to know is, is there any way to do the following....

when a user clicks on a google search result of one of my iframes, that it instead opens up the just the index page or better again the index page with the iframe that was clicked actually in the iframe. That might not make sense...hopefully it does im really stuck.
I realise i shouldnt have used iframes really :(

Member Avatar
Kraai
Senior Poster
3,937 posts since Feb 2008
Reputation Points: 56 [?]
Q&As Helped to Solve: 96 [?]
Skill Endorsements: 4 [?]
Featured
 
0
 

Please supply link to your site, I can have a look and see if I can help. It will all depend where the iframe is pointing to, maybe another site/domain? If that is the case, search engines index the original site, not the page where it is framed into.

Member Avatar
Baradaran
Junior Poster
104 posts since Feb 2007
Reputation Points: 1 [?]
Q&As Helped to Solve: 8 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi,
blocking the page in the robots.txt and preventing the pages to be listed using the meta tag <meta name="robots" content="NoIndex, NoFollow" /> is in some cases not enough. You can use a javascript to prevent the page within the iframe to be displayed as the top window. In this case the search engine may show your page, but once a user clicks on the page, he finds your page within the desired index.htm.


You can use the following code:

<script language="javascript">
if (parent.location.href == self.location.href) {
window.location.href = 'default.asp';
}
</script>

The above code would make the homepage appear each time. To prevent this, you can put a dynamic querystring in order to display the desired page:

<script language="javascript">
if (parent.location.href == self.location.href) {
window.location.href = 'default.asp?iframe_page='+self.location.href;
}
</script>

Good luck,
Ali Baradaran

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: