javascript - navigator.userAgent.indexOf('PhantomJS')是什么意思
本文介绍了javascript - navigator.userAgent.indexOf('PhantomJS')是什么意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
navigator.userAgent.indexOf('PhantomJS')是什么意思?
在vuejs的todoMVC的例子中看到的:
<!-- testing/benchmark only -->
<script>
var isPhantom = navigator.userAgent.indexOf('PhantomJS') > -1
if (isPhantom) {
localStorage.clear()
} else {
var now = window.performance && window.performance.now
? function () { return window.performance.now() }
: Date.now
var metrics = { beforeLoad: now() }
}
</script>
<!-- end testing/bench -->
demo文件地址:
https://github.com/vuejs/vue/blob/dev/examples/todomvc/index.html#L59
解决方案
testing/benchmark only
通过user agent判断是否是PhantomJS在跑test
这篇关于javascript - navigator.userAgent.indexOf('PhantomJS')是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文