Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working with Javascript
#5
(03-23-2023, 07:17 PM)valmeras Wrote: I hope also that Atozed will respond with a method to embedde external Js files, available in all the forms, in Intraweb application and have it work.

Meanwhile I use a method similar to what you are using now and it works fine.
I embedde the Js script in the form ExtraHeader and it works fine using that format:

<script type="text/javascript">
 /* JavaScript code here */
</script>

Or at runtime I can also load the Js script as an html template, like you did, or simply as a .txt file always in the Form ExtraHeader. And it works fine also!

Valmeras,

there is no difficulty to add any JavaScript file to a IW project. You just need to copy it as is to your wwwroot folder and add it to the form using the ContentFiles property:

In this particular case:

ContentFiles.Add('/ScrollLesson.js');

or in C++

ContentFile->Add("/ScrollLesson.js");

Done. It will work flawlessly.

What he wants here is a more advanced thing. He wants (1) to include the JS file as a resource, built into the executable binary file and (2) to use the InternalFiles mechanism which greatly improves the performance of IW server when serving external content as JS or CSS files.

The IWInternalFiles class not only caches the JS in memory which doesn't require any HDD access during the application life-cycle, but it only pre-compress the JavaScript files (using gzip) so the compression only happens once, during application start up which, again, greatly improves the server overall performance.
Reply


Messages In This Thread
Working with Javascript - by StephB - 03-22-2023, 10:21 AM
RE: Working with Javascript - by StephB - 03-23-2023, 08:53 AM
RE: Working with Javascript - by valmeras - 03-23-2023, 07:17 PM
RE: Working with Javascript - by Alexandre Machado - 03-23-2023, 10:29 PM
RE: Working with Javascript - by valmeras - 03-23-2023, 11:27 PM
RE: Working with Javascript - by jeroen.rottink - 03-24-2023, 10:18 AM
RE: Working with Javascript - by StephB - 03-28-2023, 04:56 PM
RE: Working with Javascript - by valmeras - 06-28-2024, 08:29 AM
RE: Working with Javascript - by Comograma - 06-28-2024, 01:55 PM

Forum Jump:


Users browsing this thread: 5 Guest(s)