我怎么知道我的meteor应用程序是否在可以在spiderable环境中运行?

时间:2015-05-26 11:41:28

标签: meteor

我需要知道我的流星应用程序是否已使用spiderable包执行。理想情况下有一个环境变量,如“isSpiderable”(布尔值)。

谢谢: - )

1 个答案:

答案 0 :(得分:1)

spiderable包通过在PhantomJS进程中执行您的应用程序客户端代码来工作,因此您可以测试用户代理签名中是否存在PhantomJS足迹。

function isSpiderable(){
  return /PhantomJS/.test(window.navigator.userAgent);
}

也看看这篇文章:http://engineering.shapesecurity.com/2015/01/detecting-phantomjs-based-visitors.html

相关问题