WordPress.org

Ready to get started?Download WordPress

Forums

WP Defer Loading
[resolved] weird code showing on the header (9 posts)

  1. wasp.ikke
    Member
    Posted 2 months ago #

    when i activate the plugin, it show me this on the header of my site.

    var element = document.createElement("script"); element.appendChild( document.createTextNode( "var display = {\"max_specific\":\"0\",\"display_view\":\"1col\",\"number\":\"84\",\"items\":\"5\",\"startPage\":\"1\",\"maxPages\":\"17\",\"nextLink\":\"http:\\/\\/rawforbeauty.me\\/page\\/2\\/\"};" ) );document.body.appendChild(element); var elementjquery = document.createElement("script"); function helperjquery(){ var elementjquery_migrate = document.createElement("script"); elementjquery_migrate.src = "http://rawforbeauty.me/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1"; document.body.appendChild(elementjquery_migrate); var elementmodernizr = document.createElement("script"); elementmodernizr.src = "http://rawforbeauty.me/wp-content/themes/themuse-parent/js/libs/modernizr.min.js?ver=3.8"; document.body.appendChild(elementmodernizr); var elementrespond = document.createElement("script"); elementrespond.src = "http://rawforbeauty.me/wp-content/themes/themuse-parent/js/libs/respond.min.js?ver=3.8"; document.body.appendChild(elementrespond); var elementgeneral = document.createElement("script"); elementgeneral.src = "http://rawforbeauty.me/wp-content/themes/themuse-parent/js/general.js?ver=3.8"; document.body.appendChild(elementgeneral); var elementcarouFredSel = document.createElement("script"); elementcarouFredSel.src = "http://rawforbeauty.me/wp-content/themes/themuse-parent/js/jquery.carouFredSel.min.js?ver=3.8"; document.body.appendChild(elementcarouFredSel); var elementtouchSwipe = document.createElement("script"); elementtouchSwipe.src = "http://rawforbeauty.me/wp-content/themes/themuse-parent/js/jquery.touchSwipe.min.js?ver=3.8"; document.body.appendChild(elementtouchSwipe); var elementcusel_min = document.createElement("script"); elementcusel_min.src = "http://rawforbeauty.me/wp-content/themes/themuse-parent/js/cusel-min.js?ver=3.8"; document.body.appendChild(elementcusel_min); var elementaudioplayer.min = document.createElement("script"); elementaudioplayer.min.src = "http://rawforbeauty.me/wp-content/themes/themuse-parent/js/audioplayer.min.js?ver=3.8"; document.body.appendChild(elementaudioplayer.min); var elementjquery.masonry = document.createElement("script"); elementjquery.masonry.src = "http://rawforbeauty.me/wp-content/themes/themuse-parent/js/jquery.masonry.min.js?ver=3.8"; document.body.appendChild(elementjquery.masonry); var elementcustomInput = document.createElement("script"); elementcustomInput.src = "http://rawforbeauty.me/wp-content/themes/themuse-parent/js/jquery.customInput.js?ver=3.8"; document.body.appendChild(elementcustomInput); var elementprettyPhoto = document.createElement("script"); elementprettyPhoto.src = "http://rawforbeauty.me/wp-content/themes/themuse-parent/framework/static/javascript/jquery.prettyPhoto.js?ver=3.1.4"; document.body.appendChild(elementprettyPhoto); } elementjquery.onreadystatechange = function () { if (this.readyState == 'complete') helperjquery(); } elementjquery.onload = helperjquery; elementjquery.src = "http://rawforbeauty.me/wp-includes/js/jquery/jquery.js?ver=1.10.2"; document.body.appendChild(elementjquery); var elementfacebook_jssdk = document.createElement("script"); elementfacebook_jssdk.src = ""; document.body.appendChild(elementfacebook_jssdk); } // Check for browser support of event handling capability if (window.addEventListener) window.addEventListener("load", downloadJSAtOnload, false); else if (window.attachEvent) window.attachEvent("onload", downloadJSAtOnload); else window.onload = downloadJSAtOnload;

    the plugin helps to defer parsing of javascript when i check it on http://gtmetrix.com/. however it is showing weird codes on the header.

    any idea how to fix these? t
    thanks

    http://wordpress.org/plugins/wp-defer-loading/

  2. bassjobsen
    Member
    Plugin Author

    Posted 2 months ago #

    Hi @wasp.ikke,

    Thanks for posting your errors. Using the plugin requires all other used plugin and your theme should enqueue their scripts proper, see also:
    http://bassjobsen.weblogs.fm/wordpress-development-properly-load-javascript-set-dependency/

    Hope this help.

    Bass

  3. wasp.ikke
    Member
    Posted 2 months ago #

    Thanks! I found a conflict that it declares the wp_head twice but i fixed it. but then it conflicts with other plugin like the facebook comments box and the sidebarfloating plugin.

    Anyway the plugin works fine but it just conflicts with other plugins that im using. Not real sure why is it happening

  4. bassjobsen
    Member
    Plugin Author

    Posted 2 months ago #

    Hi @wasp.ikke,

    As i mentioned in the blog post. In fact every plugin which outs javascript direct to the head will conflict.
    There will be to types of conflicts, the first is unexpected output and the second dependency.
    If you provide my the URL's of the plugin which has a conflict, i will write the authors and ask them to fix it.

    Regards,

    Bass

  5. wasp.ikke
    Member
    Posted 2 months ago #

    ok I understand that.

    wow thanks, your so kind. here are the plugins that ive noticed conflicts with the wp defer:

    http://wordpress.org/plugins/facebook/
    http://wordpress.org/plugins/strx-magic-floating-sidebar-maker/‎

  6. bassjobsen
    Member
    Plugin Author

    Posted 2 months ago #

    hi,

    could you try the latest version from github https://github.com/bassjobsen/wp-defer-loading/archive/master.zip ? this should fix the issues with the facebook plugin.

    The floating sidebar will follow soon.

  7. Pete
    Member
    Posted 2 months ago #

    Hi

    I also had a similar problem which I emailed you about from your contact form. I've updated the plugin to the latest version from github and it seems to have resolved the problem.

  8. Pete
    Member
    Posted 2 months ago #

    Actually the problem is still appearing can you please check my email and the website, the problem code is now in the footer since i've updated your plugin.

  9. bassjobsen
    Member
    Plugin Author

    Posted 2 months ago #

    Hi Pete,

    I have seen your screenshot. Which confirms your issue. I'm not 100% sure if it is related to Woocommerce. When i test with Version 2.0.20 i'm not able to reproduce your problem.

    Could you provide me list with other plugin you are using?

    Thanks

Reply

You must log in to post.

About this Plugin

About this Topic