【问题标题】:How to test mobile devices with Google PageSpeed Insights API如何使用 Google PageSpeed Insights API 测试移动设备
【发布时间】:2020-09-09 03:35:20
【问题描述】:

我尝试了基于文档https://developers.google.com/speed/docs/insights/v5/get-started?hl=en的API

它给"emulatedFormFactor": "desktop"

有没有办法把它改成mobile

我期待在 web-app 中出现类似下面的内容

https://developers.google.com/speed/pagespeed/insights/?hl=JA&url=https%3A%2F%2Fdevelopers.google.com&tab=mobile

在那里,我们可以通过查询tab=mobiletab=desktop来更换设备

【问题讨论】:

    标签: google-pagespeed-insights-api


    【解决方案1】:

    您正在寻找strategy,它接受“桌面”或“移动”。

    所以在你给出的例子中是:-

    https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=https://developers.google.com&strategy=mobile

    如果我理解正确,您似乎也希望它是日文的?

    要使用不同的语言/本地格式,您可以附加 locale

    所以我相信为日语添加&locale=ja。这相当于您发布的 URL 中的hl=JA

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-12-24
      • 2019-07-09
      • 2015-03-20
      • 2019-05-07
      • 2016-09-04
      • 2021-03-03
      • 2021-07-17
      相关资源
      最近更新 更多