如何在AMP网站中检测设备(Android,iOS,Windows) [英] How to detect devices (Android, iOS, windows) in AMP website

查看:107
本文介绍了如何在AMP网站中检测设备(Android,iOS,Windows)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在AMP(加速移动页面)中建立了一个网站.我想在android中显示一些内容,而不是在iOS中显示.
有什么方法可以使用AMP检测android和iOS?

I have made a website in AMP (Accelerated Mobile Pages). I want to show some content in android but not in iOS.
Is there any way to detect android and iOS using AMP?

推荐答案

您可以为此使用amp-access,您必须在authorization中标识user-agent并设置一个标志. 此处是执行此操作的示例.在示例中,device-detection检查设备是否为android,否则返回Iphone

You can use amp-access for this, You have to identify user-agent in authorization and set a flag. here is an example which does that. In the example device-detection checks if the device is android otherwise returns Iphone

这篇关于如何在AMP网站中检测设备(Android,iOS,Windows)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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