djangosnippets.org: Latest snippets tagged with 'browser'https://djangosnippets.org/tags/browser/2010-04-29T09:31:43.383324-05:00Mobile browser detection middleware
2010-04-29T09:31:43.383324-05:00pavlhttps://djangosnippets.org/snippets/2001/<p>This middleware adds a "is_mobile" (boolean) to the request object if the user's browser is a mobile browser (iPhone, Nokia, etc).
</p>
<p><strong>Example of use inside a view:</strong> <code>request.is_mobile</code>
</p>
<p><strong>Example of use inside a template:</strong> <em>You must activate the template processor "django.core.context_processors.request" in your settings. (see TEMPLATE_CONTEXT_PROCESSORS at djangoproject.com)</em> <code>{{ request.is_mobile …</code></p>
Freely redistributablebrowscap.ini-parser
2007-06-06T08:58:46.690821-05:00henninghttps://djangosnippets.org/snippets/267/<p>Sometimes you need to know if a visitor is a bot or if the browser supports certain features or if it is a mobile device.</p>
<p>The easiest way to do so would be to lookup the user agent in a capabilities database.
Fortunately there is already such a database called …</p>
Freely redistributable