Detect mobile devices with Django and Python 3

Django User Agents package is compatible with Python 3. Follow the installation instructions in the link provided above and then you can use it as follows: def my_view(request): # Let’s assume that the visitor uses an iPhone… request.user_agent.is_mobile # returns True request.user_agent.is_tablet # returns False request.user_agent.is_touch_capable # returns True request.user_agent.is_pc # returns False request.user_agent.is_bot # … Read more

Change Django Templates Based on User-Agent

Rather than changing the template directories dynamically you could modify the request and add a value that lets your view know if the user is on an iphone or not. Then wrap render_to_response (or whatever you are using for creating HttpResponse objects) to grab the iphone version of the template instead of the standard html … Read more

how to prevent iOS safari alert when trying to open non-installed native app?

Here is a solution that works for me: var timeout; function preventPopup() { clearTimeout(timeout); timeout = null; window.removeEventListener(‘pagehide’, preventPopup); } function openApp() { $(‘<iframe />’) .attr(‘src’, appurl) .attr(‘style’, ‘display:none;’) .appendTo(‘body’); timeout = setTimeout(function() { document.location = appstore; }, 500); window.addEventListener(‘pagehide’, preventPopup); }

Mobile website “WhatsApp” button to send message to a specific number

Format to send a WhatsApp message to a specific number (updated Nov 2018) <a href=”https://wa.me/whatsappphonenumber/?text=urlencodedtext”></a> where whatsappphonenumber is a full phone number in international format urlencodedtext is the URL-encoded pre-filled message. Example: Create a link with a pre-filled message that will automatically appear in the text field of a chat, to be sent to a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)