N
N
Neoliz2015-12-25 23:11:27
Django
Neoliz, 2015-12-25 23:11:27

How to determine which device is making a request to django?

Good evening! Look, there is code of the following character
The URL is directed to a django service that renders and serves the js file.
Actually, the problem is the following: for desktop platforms (PCs) you need to generate one script, and for PDAs (smartphones, tablets) you need to generate another script and give another code. How to determine from which device a request is made in django ??? Found a couple of guides. The article from habr did not help in any way from mail which

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Kitaev, 2015-12-26
@timofeydeys

1) You can try to determine based on request.META. This is a probabilistic method, there is no 100% method!
2) The backend should not take care of the platform and give different content.

S
sim3x, 2015-12-26
@sim3x

It's better not to do this - a PC can have a 1024 screen, and a tablet 4k
Focus on the screen and user behavior, and not on its type of electronics

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question