Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome on Ipad returns True for Mobile and Tablet #37

Open
peca11 opened this issue Jun 22, 2020 · 2 comments
Open

Chrome on Ipad returns True for Mobile and Tablet #37

peca11 opened this issue Jun 22, 2020 · 2 comments

Comments

@peca11
Copy link

peca11 commented Jun 22, 2020

On Chrome for Ipad the method is_mobile and is_tablet returns True for both cases.

Is this normal? Shouldn't it return False for mobile?

Are there any other known situations where mobile and tablet both return True?

Thanks!

@DevWoody856
Copy link

I am having trouble with this same problem.
Currently, I am using this module to separate the loading of css by user-agent, but if ipad of chrome, both is_tablet and is_mobile returned true, so both css are loaded and corrupted.
Any help is welcome.
Thank you.

@DevWoody856
Copy link

Currently, both iPad Air and iPad mini return "true" for both is_mobile and is_tablet.
Due to this situation, although I made CSS file separated mobile and tablet, both css loaded.

Regarding this issue, I was able to solve it with the following code.

    {% if request.user_agent.is_mobile and 'iPad' not in request.user_agent.device %}
        <link rel="stylesheet" href="{% static 'css/custom-style-sp.css' %}">
    {% endif %}
    {% if request.user_agent.is_tablet %}
        <link rel="stylesheet" href="{% static 'css/custom-style-tablet.css' %}">
    {% endif %}

In the above code, ipad air and ipad mini will only be true for the tablet and only the code for the tablet will be loaded.
(I'm only validating with chrome's dev tool.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@peca11 @DevWoody856 and others