f.haeder.net

Asynchronous loading of JavaScript and CSS files in Friendica?

@Friendica Developers what do you think? It mostly involves adding the attribute async="" to the tags.
@Friendica Developers async css friendica javascript
Way ahead of you, it’s already on develop in frio ????
BTW: Is that why I always have to reload a page until it works?
Possibly, but you would have to be more specific about the "it" if you want me to be able to do something about it. async means that the script file will be imported after the HTML and CSS to first render the page faster.

In an ideal world, all the Javascript should be executed once the page finishes loading, no matter the order between HTML, CSS, images and scripts, but unfortunately we have some examples of inline Javascript that need JQuery to be loaded first before the body loads.
My current problem with the "dev" branch is that (only on Firefox and Pale Moon, tested on Linux and MacOS) the clicking on the notifications in Frio (haven't tested the other themes) don't open the submenu, but the "notifications" page. When loading the network page, I do not have the button in the top right to create a new item. The notifications for new posts (the small numbers in the top bar) don't appear either.

I always have to reload the page so that this all works. Currently I'm on the RC with both of my servers, so I cannot do some further testing for it.
Yeah, this sounds like it could be an asynchronous-related, the reload would work because the Javascript is cached and it can be loaded faster before the Javascript is evaluated.
The console will tell you which parts are missing next time you encounter the issue though.
I will do. But I guess I will switch back to dev after the release, not before. So this will have to wait for some days.
The problem is mitigated by the fact only you reported it so far. ????
I noticed it in #vier design. Okay, not maybe fully the best solution then. However there is a JS-loader support in jQuery. I have written for this to load Scripts asynchronously a small loader: http://mxchange.org/js/ajax-loader.js It basically puts a wrapper around $.getScript()
#vier
newer older