image image Home   About   Downloads   Support   Links   Contact  
image

IntraWeb
» Feature Matrix
» What's new in IntraWeb
» Blog
» Downloads
» Test Releases
» IntraWeb for Free
» Components for IntraWeb

Resources
» Atozed Purchase Point
» IntraWeb Demos
» Documentation
» Bundled Key Request
» FAQ
» Articles
» Books
» Support
» Archived Versions

What others say
» Case Studies
» Magazine Reviews
» User Quotes






Copyright
2002 - 2014
Atozed Computer
Software Ltd.

image
Buy Online   Download Support  FAQ
Atozed Home  »  IntraWeb  »  IntraWeb Blog

XII: ServerController.OnBrowserCheck method

6/21/2011

In IntraWeb XII we have the new event OnBrowserCheck

As previosly stated in another post, IntraWeb XII will officially support the following browsers:

  • Firefox 3.6+
  • Internet Explorer 8+
  • Safari 5+
  • Chrome 11+
  • Opera 11+ ("tolerance mode" - See more info below)

IntraWeb XII 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)
  • 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)

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.Chrome
  • IW.Browser.Firefox

procedure TIWServerController.IWServerControllerBaseBrowserCheck(aSession: TIWApplication; var rBrowser: TBrowser);
var
  MinVersion: Single;
begin

  // unknown browser

  if (rBrowser is TOther) then begin
    rBrowser.Free;
    // accept the unknown browser as Internet Explorer 8
    rBrowser := TInternetExplorer.Create(8);
  end
  // if is Safari, but older version

  else if (rBrowser is TSafari) and (not rBrowser.IsSupported) then begin
    MinVersion := rBrowser.MinSupportedVersion;
    rBrowser.Free;
    // we will create it as the minimum supported version
    rBrowser := TSafari.Create(MinVersion);
  end
  // if is Chrome, but older version

  else if (rBrowser is TChrome) and (not rBrowser.IsSupported) then begin
    MinVersion := rBrowser.MinSupportedVersion;
    rBrowser.Free;
    // we will create it as the minimum supported version
    rBrowser := TChrome.Create(MinVersion);
  end
  // if is Firefox, but older version
  else if (rBrowser is TFirefox) and (not rBrowser.IsSupported) then begin
    MinVersion := rBrowser.MinSupportedVersion;
    rBrowser.Free;
    // we will create it as the minimum supported version
    rBrowser := TFirefox.Create(MinVersion);
  end
  // if is IE, but older version
  else if (rBrowser is TInternetExplorer) and (not rBrowser.IsSupported) then begin
    MinVersion := rBrowser.MinSupportedVersion;
    rBrowser.Free;
    // we will create it as the minimum supported version
    rBrowser := TInternetExplorer.Create(MinVersion);
  end;
end;

Support for Web Crawlers / Search Engines

An additional class type is TSeachEngine, which informs your application is being access by a Web Crawler / Search Engine. If a Search Engine is trying to index your application, you can, for instance, terminate your session and redirect it to a HTML file (using aSession.TerminateAndRediret) in your website that contains the information you want to submit to the search engine.

Check the IntraWeb XII demos in CodePlex for a sample application (SEODemo) showing how to implement Search Engine support in your IntraWeb application.

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 means "Tolerance Mode" for Opera 11+ Browsers?

It menas that we will not make special efforts to support it but will not refuse requests from it. Only minimal testing will be performed using Opera, and while basic support may be offered, we will not dedicate significant resources if Opera has compatibilty issues.

<< Previous Entry    Next Entry >>