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

Over time, more desktops are detecting as "mobile"... #70

Open
ursomniac opened this issue Apr 27, 2016 · 6 comments
Open

Over time, more desktops are detecting as "mobile"... #70

ursomniac opened this issue Apr 27, 2016 · 6 comments

Comments

@ursomniac
Copy link

We've used this package on a site (American Experience) and while it's done a great job for several years, we're getting complaints from some users that their browser is being detected as mobile when it's not. The frequency of these complaints is increasing with time. I've checked the lists in MobileDetectionMiddleware (middeware.py) and it doesn't appear to have changed...

Of course user complaints aren't providing information like "Oh and BTW, my user agent is [this] in case it helps" :-) so tracking down the offending user agent string(s) has not been successful.

Has anyone else experienced this effect? Has anyone made adjustments to the regex lists that improve accuracy? I'd appreciate any wisdom/suggestions...

@gregmuellegger
Copy link
Owner

I haven't had any similar reports so far. However I cannot double check as I don't use this app in production anymore. Let's keep this issue open if someone else stumbles upon it and can report helpful information.

@heysamtexas
Copy link

I'm having this problem as well. In fact, it seems to alternate between mobile / desktop when I shift-reload pages.

@maffacow
Copy link

0.7.0 is showing the Desktop version for me with Django 1.9.6 regardless of caching on an iphone 6.
I reverted to 0.6.0 and that works for me.

@undernewmanagement that sounds like a caching issue. The desktop is possibly caching and being served to the mobile. I would check your caching settings.

@gregmuellegger
Copy link
Owner

I would be willing to exchange the mobile detection with new logic. However I haven't looked into this topic for quite a while. It would be awesome if someone with more experience in this field could step up and provide some suggestions on how we could do the mobile detection in a more reliable way than currently.

@phodal
Copy link

phodal commented May 21, 2016

@gregmuellegger I think you forget to convert USER_AGENT to lowercase, it seems just convert it to lowercase will work well.

# Test common mobile values.
if self.user_agents_test_search_regex.search(user_agent.lower()) and \
    not self.user_agents_exception_search_regex.search(user_agent.lower()):
    is_mobile = True

@heysamtexas
Copy link

@gregmuellegger -- I have a fork on my machine where I plan to rip out the current detection method and replace it with the python port of mobiledetect (https://github.com/serbanghita/Mobile-Detect).

This is that port: https://bitbucket.org/trbs/pymobiledetect/overview

However, I think I will try @phodal 's solution before taking such drastic measures.

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

5 participants