Site deployment - Path issue ? ( Site A loads TMS Web app on Site B)

Hi there,

I am attempting to load my TMS VSC WebCore application from another website (https://SiteB.com/) on a separate machine. I have a page on SiteA, in which I have taken the project HTML content and updated the path for the WEbApp.js file to this other machine (https://SiteB.com/).

The page on SiteA loads the WebApp.js file, however, when the Webapp loads it assumes its assets are also located on SiteA, from which it was loaded, opposed to SiteB in which it originated from?

How do I tell the WebApp.js file, that it will find its HTML and assets files, on SiteB and not on SiteA?

Everything works as expected if the JS and assets are on the same machine.

In this instance, SiteA is a WordPress site, which is pointing to SiteB for the TMS WebApp and other associate content.

Regards
Raul

At this moment, there are no built-in configurations for this.
It is assumed the application and its resources are hosted on one server (domain).
If you want to separate this, you would need to manually configure used resource URLs to refer to another domain.

Thanks, for the feedback Bruno.

Could you perhaps elaborate on "you would need to manually configure used resource URLs to refer to another domain"?

The resources the Webapp is trying to load are the HTML files the application is creating. I can ensure that all other resources referenced in the HTML files have a fully qualified path to the domains the resources reside on or via CDN for others.

I am just not sure how to tell the Web application to load the HTML (from a particular domain) when I create forms within my application via code in the following two ways.

Example 1:

newform := TForm.CreateNew(@AfterCreate);
newform.Popup := true;
newform.ShowModal(@AfterShowModal);

Example 2:

LaunchForm(TFormClass);

procedure TfrmMain.LaunchForm(AInstanceClass: TFormClass);
var
vForm: TForm;

procedure AfterShowModal(AValue: TModalResult);
begin
end;

procedure FormCreated(AForm: TObject);
begin
(AForm as TForm).ShowModal(@AfterShowModal);
(AForm as TForm).Tag := ORTModel.ActiveIPCaseID;
end;

begin
if (Uppercase(Application.ActiveForm.ClassName) <> Uppercase(AInstanceClass.ClassName)) then
begin
Application.CreateForm(AInstanceClass, 'pnlBody', vForm, @FormCreated);
end;
end;

Is it not possible to create the form and have the HTML on another domain currently?

If not, would the Single JS File be a viable option?

Regards
Raul

Do I understand correct you want to create at runtime forms where the HTML for the form is on a different domain?
If this is the case, that isn't possible. The form's HTML URL cannot be specified, it is a HTML file with the same name as the form unit name and further no path specification.

Yes, that was my question and thank you for the feedback, Bruno.

Not sure if it is a silly suggestion, but perhaps TMS could consider having the ability to have the webcore application use the loading path for itself i.e. project.js when loading its subsequent assets.

In this way, you could have your TMS web core application loaded from another domain.

Thanks again.

This is the first such request we get.
It is unclear what the specific use-case for this request is.

My application is white-labelled, with some clients not willing to give access to their domain (understandability so). However, they are happy to link back to another domain that contains the application files.

I understand if one owns the domain in question, you have no issues, however, in my case, I am stuck without access to this other domain. In the short term, I may get away with requesting deployment access, however, rolling out features or fixes later will become a difficult task, when access is removed.

I suggest you then redirect to your domain at application start, so the entire application will run on your domain.

Thanks for the reply, Bruno.

However, that will take away the "white-labelling" aspect of the system, and clients which have an application branded for them, land up on a completely different domain (even if I make a page brand specific, its still a different domain). My clients enjoy the aspect of having the system appear to be there's, which wont be the case if you land on another domain

Can I not append a path in the code, when the application requests an assets, it just appends a URL. I am more than happy to try it out, if you could perhaps lead me in the general direction.

I am afraid that for now you will need to specify your assets programmatically with URLs referring to the proper domain where you want to load these from.

Thanks, Bruno, however, the loading of assets needed after my application is running isn't the issue (The system is generic and rebrands itself via a config file and brand-specific assets). My issue is the application itself cannot load the actual forms with which it has created as they reside on another domain (The domain the project.js files loads from).

I understand what you are referring too, however, I don’t know how to tell the WebCore application that the forms it needs to load, that the HTML file is somewhere else.

I am calling create form code (previous post), which loads the HTML, but it looks at its current location (and fails), opposed to looking at the location of the ProjectName.js (https:// NOT MY CLIENTS DOMAIN /)

Extract from clients web page (had to remove the <script in the post else it's removed)
"< type="text/javascript" src="https://NOT THE CLIENTS DOMAIN/ $(ProjectName).js">"

All I need is for the application to look at another location when loading forms, and my “Generic – White-Labelled” application will work.

Perhaps an option in the config, i.e. such as the URL could be used to achieve this. (I am willing to try this myself if you perhaps can just lead me in the direction)

Please don’t take this the wrong way, but is this such an unrealistic request ( I understand that currently, it's not a common request from developers, however perhaps they are unaware as I was, or it may not affect them as yet (Project specific) )?

I am stuck between a rock and a hard place and would need to try to develop another solution to accommodate these clients, all of which can be alleviated if I could specify the path to my WebCore application forms (HTML).

Could I not pass the path as a Param to the project, src="https://NOT THE CLIENTS DOMAIN/ $(ProjectName).js?LOOK HERE FOR YOUR FILES">"

If there is only one such .js file on the remote server, you could modify this HTML start file.