Use Delphi+Intraweb to create HTML5 offline application (cache manifest) with browser storage (webSQL/IndexedDB) possible?

StackOverflow https://stackoverflow.com/questions/8831686

Question

My current Intraweb application is actually a DataSnap Client which connect to my DataSnap Server that connects and sits together with an Interbase Server on the same machine. It works correctly but quite slow and require constant Internet connetion to work. Each button clicked or any event triggered will require the browser to connect to the Web Server (Intraweb).

I am thinking of creating an offline web application using Intraweb in Delphi XE2, HTML5 cache manifest feature, and use the browser-based SQL storage (such as webSQL or IndexedDB) as local browser storage when the mobile device goes offline. It will only connect to real DataSnap server when Internet connection is available to do initialization or synchronization back to the DataSnap Server.

Is is possible?

My main problem is to get the webpages' url out from the intraweb web application, and I do not want to put all the browser's storage code inside the template files.

It is also quite tedious to move the JavaScript code generated by Intraweb to other js files, and by doing this I may break the Intraweb application codes and logic. Is there any workaround on this?

Was it helpful?

Solution

As you stated by yourself: "Each button clicked or any event triggered will require the browser to connect to the Web Server".

This is the design of IntraWeb: a Client-Server application, in which most code logic is executed on the server side. You can add some AJAX widgets to your applications, but IntraWeb, by itself, is a Server-Side framework.

In order to have a full HTML5 AJAX Client application able to run stand-alone, you'll need a pure JavaScript application. Even Sacha/ExtJS based AJAX frameworks (like ExtPascal or UniGUI) or Morfik require a server to run.

But creating a pure HTML5 JavaScript application is some difficult task - but it is possible, since you can consume DataSnap content from JavaScript (using XML or JSON). You can try http://www.appcelerator.com/ which is a great IDE and platform for creating JavaScript applications, which run as native apps.

In order to have a disconnected HTML5 application, you may have to wait for the following products to be released:

Thanks to these two projects, you would be able to code in object pascal, then the JavaScript will be compiled from the pascal source, then use HTML local storage. See for instance this article about using storage with Smart/OP4JS - I've tested it (in Alpha), and it works very well: you have a pure stand-alone HTML file which is able to run without any server, and have local storage. SQLite3 storage is planned (not yet finished).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top