Wangkanai.Detection.Browser
2.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Wangkanai.Detection.Browser --version 2.0.0
NuGet\Install-Package Wangkanai.Detection.Browser -Version 2.0.0
<PackageReference Include="Wangkanai.Detection.Browser" Version="2.0.0" />
paket add Wangkanai.Detection.Browser --version 2.0.0
#r "nuget: Wangkanai.Detection.Browser, 2.0.0"
// Install Wangkanai.Detection.Browser as a Cake Addin #addin nuget:?package=Wangkanai.Detection.Browser&version=2.0.0 // Install Wangkanai.Detection.Browser as a Cake Tool #tool nuget:?package=Wangkanai.Detection.Browser&version=2.0.0
ASP.NET Core Detection
ASP.NET Core client web browser detection extension to resolve devices, platforms, engine of the client.
ASP.NET Core Responsive middleware for routing base upon request client device detection to specific view
Installation
Installation of detection library is now done with a single package reference point.
PM> install-package Wangkanai.Detection
Installation of Responsive library will bring in all dependency packages (This will include `Wangkanai.Detection.Device).
PM> install-package Wangkanai.Responsive
Configuration
This library host the component to resolve the access client device type.
Implement of the library into your web application is done by configuring the Startup.cs
by adding the detection service in the ConfigureServices
method.
public void ConfigureServices(IServiceCollection services)
{
// Add detection services container and device resolver service.
services.AddDetection();
// Add framework services.
services.AddMvc();
}
AddDetection()
Adds the detection services to the services container.
If you would like to add Responsive is configured in the ConfigureServices
method also:
public void ConfigureServices(IServiceCollection services)
{
// Add responsive services.
services.AddResponsive();
// Add framework services.
services.AddMvc();
}
Or you can customize the responsive
public void ConfigureServices(IServiceCollection services)
{
// Add responsive services.
services.AddResponsive(options =>
{
options.View.DefaultTablet = DeviceType.Desktop;
options.View.DefaultMobile = DeviceType.Desktop;
options.View.DefaultDesktop = DeviceType.Desktop;
});
// Add framework services.
services.AddMvc();
}
AddResponsive()
Adds the Responsive services to the services container.- Suffix Ex
*views/[controller]/[action]/index.mobile.cshtml*
- SubFoler Ex
*views/[controller]/[action]/mobile/index.cshtml*
- Suffix Ex
The current device on a request is set in the Responsive middleware. The Responsive middleware is enabled in the Configure
method of Startup.cs file.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseResponsive();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
Global Resolver
This library host the component to resolve all the access client related resolver that could resolve.
Example of calling the detection service in the Controller
using dependency injection.
public class HomeController : Controller
{
private readonly IDetection _detection;
public HomeController(IDetection detection)
{
_detection = detection;
}
public IActionResult Index()
{
return View(_detection);
}
}
IDetection
is main service for you to access detection service.
When the Detection
is pass to the view you can render results like the following example.
@model Wangkanai.Detection.Detection
<h3>UserAgent</h3>
<code>@Model.UserAgent</code>
<h3>Results</h3>
<table>
<thead>
<tr>
<th>Resolver</th>
<th>Type</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<th>Device</th>
<td>@Model.Device?.Type.ToString()</td>
<td></td>
</tr>
<tr>
<th>Browser</th>
<td>@Model.Browser?.Type.ToString()</td>
<td>@Model.Browser?.Version</td>
</tr>
<tr>
<th>Platform</th>
<td>@Model.Platform?.Type.ToString()</td>
<td>@Model.Platform?.Version</td>
</tr>
<tr>
<th>Engine</th>
<td>@Model.Engine?.Type.ToString()</td>
<td>@Model.Engine?.Version</td>
</tr>
<tr>
<th>Crawler</th>
<td>@Model.Crawler?.Type.ToString()</td>
<td>@Model.Crawler?.Version</td>
</tr>
</tbody>
</table>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Wangkanai.Detection.Core (>= 2.0.0)
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 | |
---|---|---|---|
2.0.1 | 662,853 | 9/25/2020 | |
2.0.0 | 375,083 | 12/29/2019 | |
2.0.0-beta15 | 1,282 | 12/27/2019 | |
2.0.0-beta14 | 1,174 | 12/25/2019 | |
2.0.0-beta13 | 4,784 | 12/8/2019 | |
2.0.0-beta12 | 45,880 | 8/2/2019 | |
2.0.0-beta11 | 52,354 | 5/2/2019 | |
2.0.0-beta10 | 18,220 | 2/21/2019 |