Atozed Forums
Dinamically load Javascript - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: Dinamically load Javascript (/thread-827.html)



Dinamically load Javascript - duffo64 - 11-18-2018

Hi All,

This question probably will make smile the experts, but I would need to access javascript functions imported from another site at session creation to interact with it.
They told me that I shoud use this <script src="http://www.theirsite.com:85/js/siteIntegration.js" type="text/javascript"></script>

This is the first time I am facing such a request, but really don't know the howto.

Thanks for everyone support

/Claudio


RE: Dinamically load Javascript - Jose Nilton Pace - 11-18-2018

Hi Claudio. You can load this JS OnCreate your form.

Code:
procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
  Self.JavaScript := '<script src="http://www.theirsite.com:85/js/siteIntegration.js"></script>';
end;



RE: Dinamically load Javascript - LorenSzendre - 11-18-2018

(11-18-2018, 07:41 AM)duffo64 Wrote: Hi All,

This question probably will make smile the experts, but I would need to access javascript functions imported from another site at session creation to interact with it.
They told me that I shoud use this <script src="http://www.theirsite.com:85/js/siteIntegration.js" type="text/javascript"></script>

This is the first time I am facing such a request, but really don't know the howto.

Thanks for everyone support

/Claudio

Why do you need to do it at Session creation? You can just put that script line in your ServerController.HTMLHeaders. By so doing you all of your sessions will be able to use it.

And get rid of this:

type="text/javascript"

It is not needed in HTML5 -- it is assumed that you are using JavaScript as your script language.


RE: Dinamically load Javascript - duffo64 - 11-19-2018

Thank you guys,

In the meantime I seen that I can load the JS even calling ContentFiles->Add("http:// etc etc") in ServerController constructor.
But now I would have another question: since I can load the JS in both ContentFiles or HTMLHeaders, is there any functional difference between the two ?

/Claudio


RE: Dinamically load Javascript - LaraRalston - 12-20-2018

I have got my target with this. Thanks.