ScratchData LogoScratchData
Back to Mattant's profile

Mobile Device Detection

MAMattant•Created May 30, 2020
Mobile Device Detection
3
3
85 views
View on Scratch

Instructions

Tap or click the blue button to see what type of device you are using.

Description

This is far from my first project - just the oldest I still have shared (and not unshared, then reshared). This project detects whether you are using this on a device with a touchscreen, or a device with a mouse pointer. The way these two interact with the device is very different: On a desktop, you have to move the mouse pointer from the green flag to the project in order to play it. However, on mobile, you immediately tap when you click on a part of the project. This project detects how much your mouse pointer touches the screen before you click. It is not perfect, as if you are on mobile and you drag from the edge of the screen, it counts as moving the mouse pointer without clicking, and the project then believes you are on a desktop. It also detects the mouse if you click on the middle flag. If you are quick enough, and start the project without the green flag, your desktop will may also be detected as mobile, but this is rare.

Project Details

Project ID400476133
CreatedMay 30, 2020
Last ModifiedJuly 14, 2021
SharedMay 30, 2020
Visibilityvisible
CommentsAllowed