SplatDev.Mobile.Detection
1.0.2
dotnet add package SplatDev.Mobile.Detection --version 1.0.2
NuGet\Install-Package SplatDev.Mobile.Detection -Version 1.0.2
<PackageReference Include="SplatDev.Mobile.Detection" Version="1.0.2" />
<PackageVersion Include="SplatDev.Mobile.Detection" Version="1.0.2" />
<PackageReference Include="SplatDev.Mobile.Detection" />
paket add SplatDev.Mobile.Detection --version 1.0.2
#r "nuget: SplatDev.Mobile.Detection, 1.0.2"
#:package SplatDev.Mobile.Detection@1.0.2
#addin nuget:?package=SplatDev.Mobile.Detection&version=1.0.2
#tool nuget:?package=SplatDev.Mobile.Detection&version=1.0.2
SplatDev.Mobile.Detection
Mobile device detection for ASP.NET Core — identifies mobile browsers via User-Agent header parsing and a JSON-based curated device list. Supports both HttpContext header inspection and raw User-Agent regex analysis.
Compatibility
| .NET | Umbraco | Package Version |
|---|---|---|
| 8.0 | 13 | 1.0.0 |
| 10.0 | 17 | 1.0.0 |
Installation
dotnet add package SplatDev.Mobile.Detection
Configuration
Quick check via HttpContext
using SplatDev.Mobile.Detection;
// In a controller or Razor page — inspects the request headers
bool isMobile = MobileDetection.IsMobileBrowser();
Regex-based User-Agent analysis
using SplatDev.Mobile.Detection;
// Analyze a raw User-Agent string
string userAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0...";
bool isMobile = MobileDetection.IsMobileBrowserRegex(userAgent);
Register as a middleware service
// Program.cs
builder.Services.AddScoped<MobileDetection>();
// In a controller
public class HomeController : Controller
{
private readonly MobileDetection _mobileDetection;
public HomeController(MobileDetection mobileDetection)
{
_mobileDetection = mobileDetection;
}
public IActionResult Index()
{
ViewBag.IsMobile = _mobileDetection.IsMobileBrowser();
return View();
}
}
Accessing the device list
using SplatDev.Mobile.Detection;
// The MobileDevices array contains known mobile device patterns
var deviceList = MobileDetection.MobileDevices;
// Check how many device patterns are registered
Console.WriteLine($"Tracking {deviceList.Length} device patterns");
Features
- Header-based detection via
IsMobileBrowser()— checksUser-Agent,X-Device-User-Agent, and device-specific headers - Regex-based detection via
IsMobileBrowserRegex(string userAgent)— analyzes any User-Agent string - JSON-based device list (
device_list.json) embedded in the package for offline detection MobileDevicesstatic array containing curated mobile device User-Agent patterns- No external API calls — all detection is local and instant
- Seamless ASP.NET Core integration with
HttpContextaccess - Lightweight with no third-party detection services
How It Works
The detection pipeline uses two complementary strategies:
Header inspection (
IsMobileBrowser): ChecksHttpContext.Request.Headersfor known mobile indicators such as device model identifiers, mobile browser tokens, and operating system signatures in theUser-Agent,Accept, and device-specific headers.Regex analysis (
IsMobileBrowserRegex): Applies comprehensive regular expression patterns against a raw User-Agent string, matching against the curatedMobileDeviceslist that includes iPhone, iPad, Android devices, Windows Phone, BlackBerry, and other mobile platforms.
Dependencies
| Package | Version | Purpose |
|---|---|---|
Newtonsoft.Json |
13.0.3 | JSON deserialization of the embedded device list |
Microsoft.AspNetCore.App |
— | Framework reference for HttpContext access |
SplatDev.Mobile.Detection — part of the SplatDev.Umbraco.Plugins suite. Licensed under MIT. © SplatDev Ltda.
Changelog
1.0.2 — 2026-08-24
Removes a dashboard screenshot that showed an error toast. It was captured against a site where this plugin's API was unreachable, so it advertised a broken dashboard. No screenshot is better than a misleading one; a replacement will be taken against a working install.
1.0.1 — 2026-08-24
Package metadata only: the listing now carries an icon and search tags, and the project and repository links point at the organisation that actually hosts this code. No code changes.
1.0.0 — 2026-08-24
This package now keeps a changelog. Earlier releases predate it and are not reconstructed here — consult the repository history for those. From this version on, every release records what changed for someone using it.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.2 | 46 | 8/24/2026 |