Google PageSpeed 用户代理的名称是什么? [英] What is the name of the Google PageSpeed User Agent?

查看:38
本文介绍了Google PageSpeed 用户代理的名称是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此页面表明它使用自定义用户代理,但它没有提到名字.如果用户代理来自 PageSpeed,我希望能够运行一些逻辑.Google PageSpeed 用户代理的名称是什么?

This page indicates that it uses a custom user agent but it does not mention the name. I would like to be able to run some logic if the user agent is from PageSpeed. What is the name of the Google PageSpeed user agent?

推荐答案

其他答案中的信息已过时:目前,Google PageSpeed 未在其 Google Page Speed Insights» 字符串中传递code>User-Agent HTTP 标头,它改为传递 «Chrome-Lighthouse» 字符串.
一个例子:

The information in other answers is outdated: currently, Google PageSpeed does not pass the «Google Page Speed Insights» string in its User-Agent HTTP header, it passes the «Chrome-Lighthouse» string instead.
An example:

Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36(KHTML, like Gecko) Chrome/69.0.3464.0 Mobile Safari/537.36 Chrome-Lighthouse

Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36(KHTML, like Gecko) Chrome/69.0.3464.0 Mobile Safari/537.36 Chrome-Lighthouse

请注意,即使您在其他浏览器(例如 Firefox)中运行 Google PageSpeed,该字符串也正是 «Chrome-Lighthouse».

Please note that the string is exactly «Chrome-Lighthouse» even if you run Google PageSpeed in other browsers (e.g. Firefox).

这篇关于Google PageSpeed 用户代理的名称是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆