Browser support in IntraWeb

Browser support in IntraWeb

IntraWeb XIV (and also XV) officially support the following browsers:

  • Firefox 3.6+, including Firefox Mobile
  • Internet Explorer 8+
  • Safari 5+, including Safari Mobile
  • Chrome 12+, including Android Stock Browser and Chrome Mobile
  • Opera 12 (Presto) and 15+ (Opera Next/WebKit), including Opera Mobile

IntraWeb allows the developer to make decisions regarding the browser your user is using to access your application through a new event in the ServerController.

        TOnBrowserCheckEvent = procedure(aSession: TIWApplication; var rBrowser: TBrowser) of object;

The OnBrowserCheck event will be triggered everytime a new User Session is initiated and we have the following parameters:

The OnBrowserCheck parameters explained

aSession: TIWApplication – The current user session

rBrowser: TBrowser – holds the IntraWeb class that represents the user´s Browser

Current supported Browsers (and it’s class names):

  • TSearchEngine (unit IW.Browser.SearchEngine)
  • TOther (unit IW.Browser.Other)
  • TFireFox (unit IW.Browser.Firefox)
    • TFirefoxMobile (unit IW.Browser.FirefoxMobile)
  • TInternetExplorer (unit IW.Browser.InternetExplorer)
  • TWebkit (unit IW.Browser.Webkit)
    • TSafariMobile (unit IW.Browser.SafariMobile)
    • TSafari (unit IW.Browser.Safari)
    • TChrome (unit IW.Browser.Chrome)
    • TAndroid (unit IW.Browser.Android)
    • TChromeMobile (unit IW.Browser.ChromeMobile)
    • TOperaNext (unit IW.Browser.OperaNext. Opera Next uses WebKit engine, so it descends from TWebKit class)
  • TOpera (unit IW.Browser.Opera)
    • TOperaMobile (unit IW.Browser.OperaMobile)

All these classes inherits from TBrowser (unit IW.Browser.Browser)

When rBrowser is of type TOther, IntraWeb generates an exception informing the browser is not supported. If you still want to support the unknown browser, you need to replace the object in rBrowser with a known browser class.

You need to include the unit of the Browser´s class in the uses clause (interface section):

  • IW.Browser.Browser
  • IW.Browser.Other
  • IW.Browser.InternetExplorer
  • IW.Browser.Safari
  • IW.Browser.SafariMobile
  • IW.Browser.Chrome
  • IW.Browser.ChromeMobile
  • IW.Browser.Android
  • IW.Browser.Firefox
  • IW.Browser.FirefoxMobile
  • IW.Browser.Opera
  • IW.Browser.OperaNext
  • IW.Browser.OperaMobile

procedure TIWServerController.IWServerControllerBaseBrowserCheck(aSession: TIWApplication; var rBrowser: TBrowser);
begin
  // unknown browser
  if (rBrowser is TOther) then begin
    rBrowser.Free;
    // accept the unknown browser as Firefox (probably the best idea)
    rBrowser := TFireFox.Create(TFireFox.MIN_VERSION);
  end
  // if is Safari, but older or unsupported version
  else if (rBrowser is TSafari) and (not rBrowser.IsSupported) then begin
    rBrowser.Free;
    // we will create it as the minimum supported version. Please note that we are using TSafari.MIN_VERSION class property
    rBrowser := TSafari.Create(TSafari.MIN_VERSION);
  end
  // if is Chrome, but older or unsupported version
  else if (rBrowser is TChrome) and (not rBrowser.IsSupported) then begin
    rBrowser.Free;
    // we will create it as the minimum supported version. Please note that we are using TChrome.MIN_VERSION class property
    rBrowser := TChrome.Create(TChrome.MIN_VERSION);
  end
  // if is Firefox, but older or unsupported version
  else if (rBrowser is TFirefox) and (not rBrowser.IsSupported) then begin
    rBrowser.Free;
    // we will create it as the minimum supported version. Please note that we are using TFirefox.MIN_VERSION class property
    rBrowser := TFirefox.Create(TFirefox.MIN_VERSION);
  end
  // if is IE, but older or unsupported version
  else if (rBrowser is TInternetExplorer) and (not rBrowser.IsSupported) then begin
    rBrowser.Free;
    // we will create it as the minimum supported version. Please note that we are using TInternetExplorer.MIN_VERSION class property
    rBrowser := TInternetExplorer.Create(TInternetExplorer.MIN_VERSION);
  end;
end;

EDeviceNotSupported Exception

If your application does not want to support the user browser, you can simply raise a EDeviceNotSupported (declared in the unit IWException) or terminate the session and redirect it to specific HTML file, for instance.

What about Internet Explorer 7?

According to some browser statistics, IE 7 was used by less than 0.3 % of users (April/2014). If your user refuses to update this old and unsafe browser, you can still use IntraWeb with it. We do minimal testing in IE 7, but we are aware that everything works on it.

How to enable support for older browsers?

Here is a sample code showing how to enable IE 7 support. The same strategy can be used with other versions of supported browsers, like in the most complete code above:

procedure TIWServerController.IWServerControllerBaseBrowserCheck(
  aSession: TIWApplication; var rBrowser: TBrowser);
begin
  if (rBrowser is TInternetExplorer) and (not rBrowser.IsSupported) and (rBrowser.Version < rBrowser.MinSupportedVersion) then begin
    rBrowser.Free;
    rBrowser := TInternetExplorer.Create(TInternetExplorer.MIN_VERSION);
  end;
end;