Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript链接和谷歌搜索引擎优化_Javascript_Html_Seo - Fatal编程技术网

Javascript链接和谷歌搜索引擎优化

Javascript链接和谷歌搜索引擎优化,javascript,html,seo,Javascript,Html,Seo,我有一个xml文件,其中包含指向几个内部html页面的链接。我使用HTMLDOM获取这些链接并在表中显示这些链接。这些链接是简单的html链接,没有参数。这些html页面位于服务器中 我的问题是,当我在网站管理员工具中使用fetch作为google时。google正在获取javascript,但没有获取填充的表。谷歌会抓取和索引这些链接吗?我想确保这些链接到这里的页面将被索引。。。请引导我完成这个问题。另外,请告诉我是否有更好的方法显示来自xml的内容,以便google抓取这些链接 <sc

我有一个xml文件,其中包含指向几个内部html页面的链接。我使用HTMLDOM获取这些链接并在表中显示这些链接。这些链接是简单的html链接,没有参数。这些html页面位于服务器中

我的问题是,当我在网站管理员工具中使用fetch作为google时。google正在获取javascript,但没有获取填充的表。谷歌会抓取和索引这些链接吗?我想确保这些链接到这里的页面将被索引。。。请引导我完成这个问题。另外,请告诉我是否有更好的方法显示来自xml的内容,以便google抓取这些链接

<script>
    if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.open("GET","/jobs/jobs.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML; 
document.write('<table id="example">');
document.write('<thead><tr><th>Job ID</th><th>Job Title</th><th class=\"mobexcl\">Location</th><th class=\"mobexcl\">Country</th><th class=\"mobexcl\">Date Posted</th><th>Status</th><th class=\"mobexcl\">View</th></tr></thead><tbody>');
var x=xmlDoc.getElementsByTagName("CD");
for (i=0;i<x.length;i++)
                  { 
                  if(i%2==0){
                  document.write('<tr class="alt">');
                   }
                  else{
                  document.write('<tr class="alt1">');
                   }
                  document.write("<td>");
                  document.write('<a href="' + x[i].getElementsByTagName("VIEW")[0].childNodes[0].nodeValue + '">'+x[i].getElementsByTagName("JOBID")[0].childNodes[0].nodeValue+'</a>');
                  document.write("</td><td>");
                  document.write(x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);
                  document.write("</td><td class=\"mobexcl\">");
                  document.write(x[i].getElementsByTagName("LOCATION")[0].childNodes[0].nodeValue);
                  document.write("</td><td class=\"mobexcl\">");
                  document.write(x[i].getElementsByTagName("COUNTRY")[0].childNodes[0].nodeValue);
                  document.write("</td><td class=\"mobexcl\">");
                  document.write(x[i].getElementsByTagName("DATE")[0].childNodes[0].nodeValue);
                  document.write("</td><td>");
                  document.write(x[i].getElementsByTagName("STATUS")[0].childNodes[0].nodeValue);
                  document.write("</td><td class=\"mobexcl\">");
                  document.write('<a href="' + x[i].getElementsByTagName("VIEW")[0].childNodes[0].nodeValue + '">View/Apply</a>');
                  document.write("</td></tr>");
                  }
document.write("</tbody></table>");
</script>

if(window.XMLHttpRequest)
{//IE7+、Firefox、Chrome、Opera、Safari的代码
xmlhttp=新的XMLHttpRequest();
}
其他的
{//IE6、IE5的代码
xmlhttp=新的ActiveXObject(“Microsoft.xmlhttp”);
}
open(“GET”,“/jobs/jobs.xml”,false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
文件。写(“”);
document.write('Job IDJob TitleLocationCountryDate PostedStatusView');
var x=xmlDoc.getElementsByTagName(“CD”);

对于(i=0;i爬虫程序不会在您的页面上执行脚本

谷歌已经设计了一种方法来抓取ajax网站。你可以阅读它

清单中的第三项似乎适用于你的情况

基本上,您的服务器需要创建ajax呈现页面的HTML快照,以便GoogleBot爬行

谷歌还提供了测试此设置的工具


HTH.

您好,谢谢您提供的信息。有没有一种简单的方法可以做到这一点。有没有一个分步指南呢?我很难理解设置html快照的最简单方法。最简单的方法是将您的ajax填充页面从浏览器保存到一个文件中,然后在服务器上作为url
www.yo的静态htmlursite.com?\u escape\u fragment\u=
您好,很抱歉这么晚才问。我有一个问题。如果我当前的ajax页面是www.mysite.com/pag1.html,那么我是否要创建一个文件名为page1的静态页面?\u escape\u fragment\u=.像.html这样的文件名不会有扩展名吗?我有点困惑,请指导我。这个问题看起来很简单离题,因为它是关于搜索引擎优化