I have a website that uses iframes to display content. If the URL to a content is called directly by the user it should be "jailed" into the main page.
The main page provides a header and a footer as well as the navigation menu. There is one iframe named contentframe. All links in the navigation (and footer and stuff) target this frame.

My Solution for "jailing"
First I find out whether the page is already jailed via javascript (that's simply done with something like var jailed = (window.self != window.top); where jailed will be true if the page is "jailed" already.
Next I redirect (using javascript) to the main page with a parameter called referrer passing it the URL of the page which should get "jailed". This PHP script reads this parameter and sets it as the src argument of the iframe.
This way the main page is loaded within the iframe.

This way I can directly link to a content and after only one reload everything will be displayed just fine. But I have questions regarding some issues.

My Questions

  1. Are there seo problems?
    I think, that google can index the contents of my site (links provided at least by the sitemap.xml and of course through the navigation links). But what about this javascript redirect? It's not cloaking, but is it problematic? Will Google punish me for that somehow?
    I found out, that it's hard to find some info material for this topic.

  2. What about best practices?
    I know how to do what I want to do technically, but how about best practices? I couldn't find anything so far, but maybe some of you had to deal with that. Or is my solution perfectly fine?

I know iframes are not a very elegant way for displaying the content (from the same domain), but I'm stuck with it and I must deal with it, so please no "do not use iframes comments" :-)

Please, no opinions. I'm quite sure there are some facts on how to do this the best way.

The following link describes that the intent is very important. In a way I'm showing different content to GoogleBot than to my user, technically. But the content really stays the same only it is decorated a bit. But what does GoogleBot say? Cloaking and/or Sneaky Redirects

  • Unless we can test this directly, it's going to result in some level of opinionated answers. Also, is there an action from the user which triggers the JavaScript redirect, or is it automatic without any user interaction?
    – dan
    Dec 19, 2013 at 18:47
  • It's an automatic redirect. My hope is, that some google developer who can judge this reads my question, but I'm also very happy about experiences made by others. I'm pretty sure I'm not alone with this problem.
    – beipawel
    Dec 20, 2013 at 10:19
  • 1
    Hoping for a google employee to answer this is a little too optimist in my opinion, perhaps you would have better luck going to their official forums groups.google.com/forum/#!forum/SEO1
    – Purefan
    Jan 2, 2014 at 12:24

1 Answer 1


Here is a thread on WebmasterWorld from 2007 in which user seoogle claims that he can achieve good rankings with a similar technique:

I have a client that insists on using frames. In spite of this I have been able to achieve good rankings and maintain a pretty easy to navigate/spider site by among other things, using javascript to reload stray pages back into their frameset.

  • 1
    What you're quoting is only one half of the story. This technique described in the quote was doing OK until beginning of 2007. After that google started to index the title of the frameset page not the singular/orphan pages which results in bad seo results. A second developer added he was using the same/similar technique and also encountered the same problem of pages having the wrong title in the search results. So I know that frames are history and shouldn't be used except for some sort of tasks but this article still answers the question to some degree, so I accepted it. Thanks.
    – beipawel
    Mar 28, 2014 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.