mobile-website
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
Disable pinch/zoom in Android 2.1 browser on HTC devices
I have contacted HTC about this issue and they have informed me that they don’t have support for the viewport meta tag at all and there is no other way to disable zoom. Quite disappointing.
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); }
Difference between visual viewport and layout viewport?
The visual viewport is the part of the page that’s currently shown on-screen. The layout viewport can be considerably wider than the visual viewport, and contains elements that appear and do not appear on the screen. Imagine the layout viewport as being a large image which does not change size or shape. Now imagine you … Read more
Tips for optimizing a website for Android’s browser? [closed]
I rely on two elements to optimize websites for mobile browsers (especially Android and iPhone): Meta tags: HandheldFriendly and viewport Usually I want pages not to have a page width of 800 to 900 pixels, as the Android and iPhone browsers set it to by default. To have the page width the same as the … Read more
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
How to detect a long touch pressure with javascript for android and iphone?
The problem with using Touch End to detect the long touch is it won’t work if you want the event to fire after a certain period of time. It is better to use a timer on touch start and clear the event timer on touch end. The following pattern can be used: var onlongtouch; var … Read more