A browser detect library for .NET Standard 2.0.
Install-Package DetectionCore
- Internet Explorer
- Microsoft Edge
- Chrome
- Firefox
- Safari
- Opera
- NintendoBrowser
string userAgent = "mozilla/5.0 (Linux; Android 6.0.1; Nexus 5x build/mtc19t applewebkit/537.36 (KHTML, like Gecko) Chrome/51.0.2702.81 Mobile Safari/537.36";
if (userAgent.TryDetectBrowser(out BrowserType browserType, out string? browserDetail))
{
Console.WriteLine($"BrowserType: {Enum.GetName(typeof(BrowserType), browserType)}"); // BrowserType: Chrome
Console.WriteLine($"Browser: {browserDetail}"); // Browser: Chrome 51
}
- Windows(each consumer version, over WindowsXP)
- MacOS(each version, over Mac OS X v10.5)
- Chrome OS
- Ubuntu
- Mint Linux
- Fedora
- Gentoo
- FreeBSD
- OpenBSD
- NetBSD
- Nintendo Wii
- Nintendo WiiU
- Nintendo Switch
- Nintendo 3DS
- PlayStation 2
- PlayStation 3
- PlayStation 4
- PlayStation Vita
- iOS
- Android
- Windows Phone
string userAgent = "mozilla/5.0 (Linux; Android 6.0.1; Nexus 5x build/mtc19t applewebkit/537.36 (KHTML, like Gecko) Chrome/51.0.2702.81 Mobile Safari/537.36";
if (userAgent.TryDetectPlatform(out PlatformType platformType, out string? platformDetail))
{
Console.WriteLine($"PlatformType: {Enum.GetName(typeof(PlatformType), platformType)}"); // PlatformType: Android
Console.WriteLine($"Platform: {platformDetail}"); // Android 6.0.1
}
@MeilCli don't regularly use this library, but would like to add a new detection if requested.
- C# 8.0
- Visual Studio 2019 Preview
- .NET Core 2.2 and 3.0
This library is under MIT License.
- System.Memory, published by MIT License