How to manage the head script order when putting the javascript in the webscreen section, what's the outsystems considered order? Let's say that I have two pages,each one with javascript code and I want to switch the load order.

Solution

Hi Filipe,

I assume that you're talking about Traditional Web applications.

If so, the answer is straight forward - you cannot control.

There are however, some assumptions that you can have - the order of the blocks in the page, will most likely affect the order in the head. e.g.:

|---------------------|---------------------|---------------------|

|--- BLOCK C ---|--- BLOCK A ---|--- BLOCK B ---|

|---------------------|---------------------|---------------------|

The head will look like:

<script src="blockC.js"/>
<script src="blockA.js"/>
<script src="blockB.js"/>

Switching the order of the JS files, sounds strange, and sounds that this logic should be done in the JS not in the blocks.

If you can share more details, I might be able to help you more.

Cheers,
RG


Solution

Ruben Goncalves wrote:

Hi Filipe,

I assume that you're talking about Traditional Web applications.

If so, the answer is straight forward - you cannot control.

There are however, some assumptions that you can have - the order of the blocks in the page, will most likely affect the order in the head. e.g.:

|---------------------|---------------------|---------------------|

|--- BLOCK C ---|--- BLOCK A ---|--- BLOCK B ---|

|---------------------|---------------------|---------------------|

The head will look like:

<script src="blockC.js"/>
<script src="blockA.js"/>
<script src="blockB.js"/>

Switching the order of the JS files, sounds strange, and sounds that this logic should be done in the JS not in the blocks.

If you can share more details, I might be able to help you more.

Cheers,
RG


Hi RG,I'm also facing a similar issue where I have a web block which call from another web block from another module hence the web block nested deepest within will have its JS file loaded in the top few within the <head> but the files needed for the web block need to be loaded after the jQueryUI.js file from the rich widget so that it will not throw an error on the screen "$.widget.extend is not a function" any advise on how I could re-arrange the order needed for the JS file? Thanks