Hi OC,

Offhand what you are asking is probably possible; however I have a suggestion 
to not fight against the grain.

If you are using prototype, then wait for the “dom loaded event” like so:
http://api.prototypejs.org/dom/document/observe/ 
<http://api.prototypejs.org/dom/document/observe/>

jQuery has something similar:
https://api.jquery.com/ready/ <https://api.jquery.com/ready/>

If you aren’t using either you could choose window or document onLoad:
https://stackoverflow.com/questions/588040/window-onload-vs-document-onload 
<https://stackoverflow.com/questions/588040/window-onload-vs-document-onload>

In this way, you can put it in the head, and then it will only be executed 
after all the DOM elements are on the page :-)
AARON ROSENZWEIG / Chat 'n Bike <http://www.chatnbike.com/>
e:  aa...@chatnbike.com <mailto:aa...@chatnbike.com>  t:  (301) 956-2319        
        
        

> On Jan 26, 2020, at 12:09 PM, OCsite via Webobjects-dev 
> <webobjects-dev@lists.apple.com> wrote:
> 
> Hi there,
> 
> for once, no deep mystery, but a plain API-related question :)
> 
> I am just switching my old very hap-hazard and ugly way of loading 
> javascripts as needed by components to the very neat ERXComponent's support 
> of additionalJavascriptFiles. Mostly it works like a charm, but for two cases:
> 
> (i) scripts which are generated programmatically
> 
> So far, I have used directly in the particular component template something 
> like
> 
> ===
> <wo:ERXJavaScript scriptKey="cz.ocs.SomeScript.generated">
>     <wo:string value="$generatedSomeJS" escapeHTML="no"/>
> </wo>
> ===
> 
> Is there a way to exploit somehow the ERXComponent's support for that, to 
> move these scripts to the <head> too?
> 
> (ii) scripts which need to be placed at the end of page
> 
> Far as I was able to ascertain, all the <script...> tags for the scripts from 
> additionalJavascriptFiles are always generated to <head>. Mostly it's 
> precisely what I need, but time to tome, the script needs to be placed at the 
> end of page (for it runs something which addresses the page elements). Is 
> there a way to use the ERXComponent's support for that?
> 
> Thanks a lot,
> OC
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com
> 
> This email sent to aa...@chatnbike.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to