How to check the project version ofTMS Web Core on client web page?

How to check the project version ofTMS Web Core on client web page?
because we want to do empty cache and hard reload when the project version change.

It is returned by Application.Version: string

I checked the version infomation as '2.0.2.1 Pescara' by ShowMessage( Application.Version ).
I want to know the ProductVersion information on Application.Version Infor .

Hi!
AFAIK the project version is not stored in the .js file.
I use the following logic:

  • compilation is via .bat file, the project name and the version is passed via parameter (the .bat file calls the TMS Web Core commandline compiler)
  • the .bat file writes the version into a simple ascii file:
    @echo '%2' > BUILD.CON
  • in a unit .pas file I have the lines
const _BUILDNR=
{$I BUILD.CON}
;
  • the .bat file also writes the version number to a MariaDB database
  • the web app reads the version number from this database on startup
  • if it does not match, it shows up a Button called "Update!"
  • in the event handler of this button this line is executed:
    document.location.reload(TRUE);

Why so complicated? Because I didn't find an easier way to bypass the caching mechanisms of the browsers.

Best regards,
Meik

This is what I've been doing.

  1. In my Project.html file, I add an extra line of code here, storing the $(ProjectName) variable for future use. This is at the end of the file:
  <script type="text/javascript">
    ProjectName="$(ProjectName)";
    rtl.run();
  </script>
  1. In the Project Options for TMS WEB Core, I set the "Auto-increment version" option to "enabled".
  2. Then, in my regular project, I can output something like this.
procedure TForm1.WebFormCreate(Sender: TObject);
var
  AppVer: String;
  AppRel: String;
begin
  // Output Version Information
  asm
    AppVer := ProjectName;
    AppRel := document.lastModified;
  end;
  console.log('AppVersion: '+AppVer);
  console.log('AppRelease: '+AppRel);
  console.log('TMSWEBCore: '+Application.Version);
end;

Which gets me something that looks like this:

AppVersion: Project1_1_0_6
AppRelease: 10/14/2022 09:44:47
TMSWEBCore: 2.0.2.1 Pescara

Figuring out if the version number is the most current version involves more work, as it has to be retrieved from somewhere else, like a web page or an XData service endpoint or something like that. The "Release" date here is coming from the web server, indicating the timestamp on the file, so as long as the file is updated soon-ish after the project is built, this is reasonably accurate.

There's a TMS Blog post I wrote about PWAs that also describes how to format the date using Luxon, and other items that may be of interest. You can check it out here.