Implement error page navigation using the Network Check failed OnNetCheckFailed handler

Version 1

    Verified Product Versions

    Wavelink Naurtech CETerm 5.7

    It is possible to configure a special event handler which will trigger when the RF signal cannot be detected for browser sessions. The handler can then navigate to a pre-defined URL. This technique can be important on WinCE platforms because the browser does not seem to preserve parameters when executing a "file:" type navigation. Without parameters, a static "error page" will not be able to determine the original target URL of the send request and will not be able to "re-try" the navigation.

     

    The OnNetCheckFailed event will be generated if the network check action is ida://IDA_SCRIPT_ON_NETCHECKFAILED

     

    The event will call the function OnNetCheckFailed( session, targetURL );

     

    The handler for this event must already be defined and loaded into the CETerm script engine in order to be activated. A sample handler for this event might consist of:

     

    function OnNetCheckFailed( session, targetURL )

    {

        // Save target URL

        CETerm.SetProperty( "app.usertext.10", targetURL );

        // Navigate to static page

        var b = CETerm.Session( session ).Browser;

        b.Navigate("file:///error.htm");

    }

    This handler will save the target URL into the User Text 10 area to make it available to the error.htm file. The error file may contain code which retries the original link, such as (for WinCE or .NET devices) shown below:

     

    function RetryTargetURL()

    {

       location.href = external.CETerm.GetProperty( "app.usertext.10" );

    }

    If using this technique on Windows Mobile, you will need to create and use a CETerm (a.k.a. CEBrowseX) component rather than using the "external" object to access the CETerm.GetProperty().

     

    This technique will also work on Windows Mobile platforms but is not required because the PocketIE on Windows Mobile will pass the parameters to a "file:" navigation. In this case, the network check action can be:

     

    file:///error.htm

    The handler will append, for example:

     

     

    ?badlink=http://server.thisdomain.com/application.exe?param=1&param2=4

    And the badlink parameter can be extracted and used in the error.htm page.