Thanks Felix. That worked. I’ve now included the script, plus my options script, the theme css and language css in the TMLs that need it, and Offline is now working well.
BTW, I think Offline.js has a flaw in its init logic which could still occur sometimes. It assumes that if document.readyState is not “complete” then document event “DOMContentLoaded” must not yet have happened, which is a wrong assumption that leads to “init” not being called and therefore the UI not being set up. By comparison, Tapestry’s jquery.js module is smarter - it listens for document event "DOMContentLoaded” and, just in case that has already happened, for window event “load”. On either of those events it removes both listeners. > On 19 May 2016, at 10:15 PM, Felix Gonschorek <fe...@netzgut.net> wrote: > > Hi Geoff, > > still fighting with Offline.js ? :-) > > What about loading offline.js in the head of the document, with a regular > <script src="${asset:xxx}" /> tag as a child of the <head /> tag? Tapestry > is being loaded at the end of the document before the closing </body> tag. > > > > 2016-05-19 15:19 GMT+02:00 JumpStart <geoff.callender.jumpst...@gmail.com>: > >> In T5.4, how can I make a script load ahead of all the others, including >> Tapestry’s js? The others load async so I think I need this one to load >> synchronously. . >> >> The script is offline.js. My problem is that offline.js works only >> sometimes - it has its own detection of DOMContentLoaded and >> document.readyState, which I think is in a race condition with Tapestry’s >> handling of the same thing. I think it might be fine if I can guarantee it >> runs before anything else. >> >> A better solution would be for offline.js to be made AMD compatible, which >> means exposing its “init" function so that we can use "require" to call >> “init" after the document has loaded, but that requires hacking offline.js >> which I would rather not do yet. >> >> Geoff >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org