|
|
|
|
|
- Overview
- Implementation
- Defining the resources to cache
- Configuring the server
- Programming technique
- Site test
Warning
From version 23 (50), this feature is no longer available.
WEBDEV allows you to specify that a site or a set of pages can operate in off-line mode (without an Internet connection). If the site can operate in offline mode, all the resources (pages, images, .js files, .css files) used by the site or by the pages are automatically cached by the browser on the computer of the Web user. Therefore, the site can be used without having to reconnect to the Internet. The browser function BrowserIsConnected allows you to find out whether the browser is in online or offline mode and to adapt the site behavior accordingly. This feature uses the management of manifests available with HTML 5. Some browsers (especially Internet Explorer 8 or earlier browsers) do not support this feature. Remark: This site caching mechanism is specific to HTML 5: - Prior to HTML 5, only the visited pages could be cached.
- With HTML 5, the cache mechanism is performed from the first connection to a site. A specific manifest file is used to list all the resources to cache.
Defining the resources to cache Defining the resources to cache is performed in the development environment. To indicate the pages available in offline mode: - Open the WEBDEV project if necessary.
- On the "Project" pane, expand "Web" and select "Cache (offline mode)".
- In the window that is opened, select the pages to cache.
Caution: Only the dynamic PHP pages, the dynamic Active WEBDEV Pages and the static pages can be cached. - Close the window.
During the next recompilation of the project, the "<Project_Name>.manifest" file is automatically generated in the language subdirectory found in the _WEB directory of the project. This file will contain the specified pages as well as all their dependencies (images, CSS style sheets, JavaScript files, ...). Configuring the server The use of a manifest requires a specific configuration of the server. You must configure a specific mime type: ".manifest" associated with "text/cache-manifest" To run the test of your site, this configuration must be performed on the development computer. Remarks: - The configuration of the mime type is automatic.
- This mime type is not configured yet for all the hosting companies.
- This mime type is not supported by some browsers.
Programming technique A cached site can be used for example: - to simulate an iPhone application (creation of a Web application that operates in offline mode only).
- to manage a site that would lose the Internet connection.
Programming tips: - The principle is to mainly use browser code. Indeed, only this code can be run off-line. However, you have the ability to use a server code via AjaxExecute (that is used to run a server code in a browser process).
- Only the browser controls are available. Only the list boxes, buttons, edit controls, static controls, images, links, menus, check boxes and radio buttons can be used in the pages in off-line mode.
- The buttons and the links must not have the "Submit" type. However, you have the ability to use the "Display the page XXX" action.
- If the data backup is required in off-line mode, a local database must be used. The HTML 5 standard allows the Internet sites to use a local database managed by the browser. For more details, see SQL Database local to a browser.
- If the site must operate both in online mode and in offline mode, you have the ability to use BrowserIsConnected in browser code to find out whether a server code can be run or not. In case of disconnection, a specific procedure or process can be started to prevent the server code from being run.
- Use the optional processes of the page ("Switch to off-line mode", "Switch to on-line mode" and "Whenever the status of the HTML cache changes") to perform the processes required to change status (retrieving the data from the local database for example).
Site test To run the test of a cached site: - Configure (if necessary) the server of the development computer.
- Run the test of the site (Go). All the necessary pages are cached.
- Use the "Work offline" option of the browser.
- Run the test of your site.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|