如果我通过 JavaScript 在页面中添加内容,它是否可以被搜索引擎蜘蛛抓取并且可以被屏幕阅读器访问。
对于 example this
var tip = "<p>Most computers will open PDF documents ";
tip += "automatically, but you may";
tip += "need to download <a title='Link to Adobe website-opens in a new window'";
tip +=" href='http://www.adobe.com/products/acrobat/readstep2.html'
target='_blank'>Adobe Reader</a>.</p>";
$(document).ready(function(){
//IF NUMBER OF PDF LINKS IS MORE THAN ZERO INSIDE DIV WITH ID maincontent
//THEN THIS WILL PUT TIP PARAGRAPH AS LAST CHILD OF DIV
if($("div#maincontent a[href*='/pdf']").length>0){
$("div#maincontent").children(":last-child").after(tip);
}
});
编辑:我想从搜索引擎中隐藏它,但同时让屏幕阅读器可以访问它,这可能吗?
最佳答案
这取决于爬虫,但不要指望大多数机器人都能解释 Javascript。
关于javascript - 如果我通过 JavaScript 在页面中添加内容,搜索引擎蜘蛛是否可以抓取它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3090098/