Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Remove defer attributer from a script

$
0
0

Replies: 0

Hi, @optimizingmatters

I need your help please.

I am trying to resolve my issue for many hours but no luck( Feel very frustrating.

Here are my options:

Optimize JavaScript Code? – Checked

Aggregate JS-files? – Checked

Also aggregate inline JS? – Checked

Force JavaScript in <head>? – Unchecked

jQuery is not excluded from Autoptimize.

So all the js files with the jquery.js as well and inline js are merged to the one js file and moved to the end of the page that is fine.

Everytime I clear the Chrome cache to test how the site works weird things happen. My masonry layout is broken, images have crazy position on the page, huge margins between them, logo font size animating from small to big, so defenitely something is wrong how Chrome renders the page. Please note everything work fine when Autoptimize is off.

The only helped checking Force JavaScript in <head>? option. Then everything works fine. But I would like to put js at the bottom.

I did notice when moving the js file to the bottom it has defer attribute. When moving the file to the top it does not have such an attribute.

So I installed your another Async JavaScript plugin and added with a help of it the defer attribute to my top js file and tested how it goes. With the defer attribute for the top js file the issue appears.

I assume if remove the defer attribute from the bottom js file the issue will disappear. Not sure of course but I hope.

Can you please help to get rid of that defer attribute from the bottom js file? Perhaps some function in theme functions file or just update the plugin directly?

Really hopes this can help.

Kind regards

  • This topic was modified 1 hour, 3 minutes ago by Valenki.
  • This topic was modified 19 minutes ago by Valenki.

Viewing all articles
Browse latest Browse all 59525

Trending Articles