/// <summary> /// Gets the IBrowser instance. /// </summary> /// <returns>The IBrowser instance.</returns> private IBrowser?GetBrowser() { if (this.httpContextAccessor.HttpContext?.Request?.Headers?.TryGetValue(Headers.UserAgent, out var uaHeader) == true) { return(Detector.GetBrowser(uaHeader[0].AsSpan())); } return(default);
/// Populates a browser object from the userAgentString value /// </summary> /// <returns>A browser object or null</returns> private IBrowser GetBrowser() { var userAgentString = this.httpContextAccessor.HttpContext.Request.Headers["User-Agent"][0].AsSpan(); // tablet or desktop return(Detector.GetBrowser(userAgentString)); }