Remove Render-Blocking JavaScripts

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 years ago
Hi there!

Yes, all codes were replaced.

The problem is, we cant use bundle scripts with it. Second, we have to guarantee that jquery will be loaded first, always, or we will get script error.

There is some examples to defer multiple scripts, maybe we need to improve the downloadjs code a little bit more:

http://mawaha.com/deferring-script-loading-javascript/

Ivan.
8 years ago
I just tried a better approach:

http://stackoverflow.com/questions/5852767/possible-to-defer-loading-of-jquery/18405468#18405468

And the scripts are loading fine.

BUT, the problem now is that $(document).ready is running before defer is done, so Im getting "Uncaught ReferenceError: $ is not defined" error.

Keep walking!! Lets do it..
8 years ago
ivanslater wrote:
I just tried a better approach:

http://stackoverflow.com/questions/5852767/possible-to-defer-loading-of-jquery/18405468#18405468

And the scripts are loading fine.

BUT, the problem now is that $(document).ready is running before defer is done, so Im getting "Uncaught ReferenceError: $ is not defined" error.

Keep walking!! Lets do it..

I'm running into the same error.
But it still happens, even when I don't defer loading of jQuery...

Please keep each other updated, it must be possible :)
8 years ago
Does it pass through google's  PageSpeed Insights even it is giving that error?
8 years ago
Hi guys!

Any news?
8 years ago
I ran into really weird issues, that $ was not a function INSIDE a $(document).ready().
And, the major issue with nopCommerce is the inline scripts. E.g. AjaxCart is inline, which requires some libraries. So, I ended up not deferring jquery, ajaxcart, etc. In the end 8/10 scripts were not deferred, so not useful.

So it's much more work. First, all inline scripts should be put in a separate JS file, and then deferring can be implemented.

I'd still appreciate a reply from a.m. who said it's just not possible.
8 years ago
Hi!

Well, not possible is living forever.. all other things are! Hahahahaa

I have got some jquery $ errors too, but Im still trying some other approaches. Once Google started to consider (since April 21st) mobile friendly sites in SERP and the blocking scripts are one of most degrading page score, we need to fix it as soon as possible.

I know we will find a way.. lets back to work!!

Any news I let you know.
8 years ago
ivanslater wrote:
Hi!

Well, not possible is living forever.. all other things are! Hahahahaa

I have got some jquery $ errors too, but Im still trying some other approaches. Once Google started to consider (since April 21st) mobile friendly sites in SERP and the blocking scripts are one of most degrading page score, we need to fix it as soon as possible.

I know we will find a way.. lets back to work!!

Any news I let you know.

Yeah, it is a major issue.
First of all, ALL inline javascript that relies on 3rd party libraries (e.g. jquery) must be moved to a js file. Agreed?

This will be a major improvement to nopCommerce. When we succeed, it should be in the next nopCommerce version.

I'm very busy at the moment, hope I find some time next week. Let's update in this thread when we have news!
8 years ago
any news?
8 years ago
dianoche wrote:
any news?

There are +- 300 instances of inline scripts... To implement 100% deferred loading, ALL of this javascript must be in a separate JS file...
:|
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.