My company sells a Q&A solution for e-commerce sites. They basically have a button on their product pages that opens an iframe containing a forum with questions and answers.

We would like the content to be referenced by search engines, but as we are using iframes it will not work.

Can we simply call a javascript on page load, inserting the content into the page, but only if it's a Google bot crawling the site ?

2 Answers 2


No. That would be serving content specifically for the benefit of search engines (i.e. to manipulate your rankings) which is against the terms of service of the search engines (i.e. this is black hat SEO). You either need to make this content available outside of an iframe, link to the iframe in your XML sitemap (assuming the contents can be loaded as a stand alone page), or accept this content as not being available to be indexed.

  • What if we always insert the content, but inside a div set to display:none ?
    – ThunderDev
    Commented Oct 16, 2014 at 14:20
  • Same exact thing
    – John Conde
    Commented Oct 16, 2014 at 14:21
  • Even worse actually. Never serve different content to bots as to users
    – Martijn
    Commented Oct 16, 2014 at 14:25
  • "always insert the content" - If it's set to display:none and Google determines that it is never shown then it will be ignored (or, worst case, seen as possible spamming.)
    – MrWhite
    Commented Oct 16, 2014 at 14:49

Instead of using iFrames, you could load the content into the page using AJAX. Then you could implement Google's crawlable AJAX.

That way both users and bots would be able to get the content.

  • Yes that seems to be the best choice. However, we use an iframe so that the CSS of our Q&A solution is not compromised by the clients CSS. We would need to overload every single CSS property for it to work.
    – ThunderDev
    Commented Oct 16, 2014 at 15:48
  • You could have the AJAX write the content into an iFrame so that it doesn't inherit the CSS of the page. Commented Oct 16, 2014 at 15:53
  • Would that not inhibit the content from being crawlable ?
    – ThunderDev
    Commented Oct 16, 2014 at 16:15
  • You could still provide HTML snapshots to Googlebot using crawlable AJAX. Commented Oct 16, 2014 at 16:16
  • Although if its written into the iframe, will it still be read as on the iframe page and not on the page the iframe is being displayed on?
    – Max
    Commented Oct 16, 2014 at 23:11

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.