如何检测 Django 中的浏览器类型? [英] How to detect Browser type in Django?

查看:38
本文介绍了如何检测 Django 中的浏览器类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检测客户端使用的浏览器类型.我有一个问题,我必须要求人们使用不同的浏览器(Firefox)而不是 IE.我怎样才能得到这些信息.

How can i detect which browser type the client is using. I have a problem where i have to ask people to use different browser (Firefox) instead of IE. How can i get this information.

我知道 http 请求有这个信息(标题).我将如何从 Django 框架中的 view.py 中获取 navigator.appName ?

I know http request has this information (Header). How will i get the navigator.appName from the view.py in the Django framework ?

推荐答案

您可以像这样从请求对象中提取该信息:

You can extract that information from the request object like so:

request.META['HTTP_USER_AGENT']

这篇关于如何检测 Django 中的浏览器类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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