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 :(

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.