Browser

Determining which browser the user is running, what language it has been configured with, whether it is a Desktop, Mobile, or Tablet device, is some of the information that are accessible using the Browser namespace.

User agent
Determining the browser currently displaying a website or web application is easy.

GetInfo
var info = Fit.Browser.GetInfo();
var info = // Example object returned from GetInfo
{
    Name: "Chrome", // Possible values: Chrome, Safari, Edge, MSIE, Firefox, Opera, Unknown
    Version: 51,
    Language: "en",
    IsMobile: false,
    IsPhone:false,
    IsTablet:false
}


Query String (URL)
Reading and parsing out the components of the URL currently being displayed is as simple as calling GetQueryString.

GetInfo
var url = Fit.Browser.GetQueryString();
var url = // Example object returned from GetQueryString
{
    Url: "http://server.com/pages/index.php?Query=FitUI&Preview#ArticleC",
    Parameters:
    {
        Query: "FitUI",
        Preview: ""
    },
    Anchor: "ArticleC"; // Null if no anchor (e.g. #ArticleC") is defined in URL
}


Screen and viewport dimensions
To optimize the web experience, knowning the dimensions of the screen and browser window can be helpful.

 GetScreenDimensions
var size = Fit.Browser.GetScreenDimensions();
var size = // Example object returned from GetScreenDimensions
{
    Width: 1024,
    Height: 768
}

// Often the operating system takes up space on the screen that the
// browser window cannot use (e.g. the Start menu or Dock on Windows/MacOS).
// Pass True to GetScreenDimensions to get the actual space available on the screen.
var size = Fit.Browser.GetScreenDimensions(true);
var size = // Example object returned from GetScreenDimensions
{
    Width: 1024,
    Height: 720
}


 GetViewPortDimensions
var size = Fit.Browser.GetViewPortDimensions();
var size = // Example object returned from GetViewPortDimensions
{
    Width: 979,
    Height: 624
}
Fit.UI is open source (LGPL) - download or fork it on GitHub - website powered by Sitemagic CMS