How To Include An Html Page In Another Page And Have Its Contents Be Crawlable

- 1 answer

I need to include an html page inside another html page, and I want the contents of the included page (page2.html) to be indexed by google. I know iframes are not the solution, but how well do search engines handle html objects:

document.getElementById("content").innerHTML = '<object type="text/html" data="page2.html"></object>';

vs jQuery:

$(function(){$("#content").load("page2.html"); });
// <script type="text/javascript" src="../common_files/js/jquery-2.1.3.min.js"></script>  <-- in header

for html:

<div id="content"></div>

? Or is there another better solution? Thanks in advance.



There are no 100% guarantee that content will be crawled by google if you use javascript/jquery.

You need to do it on server side. In PHP you can use file_get_contents function to get page2.html

$homepage = file_get_contents('');

and put $homepage variable into first page.