WordPress.org

Forums

Alfie WP Weather
[resolved] Won't work if javascript loaded asynchronously or moved to footer (4 posts)

  1. jsmi
    Member
    Posted 1 year ago #

    I'm looking for some way to load my website's javascript files asynchronously or move them to footer. I tried using the Asynchronous Javascript plugin, but Alfie isn't working with it.

    Also used the following code, which also hides Alfie:

    remove_action('wp_head', 'wp_print_scripts');
    remove_action('wp_head', 'wp_print_head_scripts', 9);
    remove_action('wp_head', 'wp_enqueue_scripts', 1);
    add_action('wp_footer', 'wp_print_scripts', 5);
    add_action('wp_footer', 'wp_enqueue_scripts', 5);
    add_action('wp_footer', 'wp_print_head_scripts', 5);

    Could you please check the compatibility with Asynchronous Javascript? Whitelisting the js files in Alfie's js folder also didn't work.

    I'm badly in need of Asynchronous Javascript, as it improves my loading speed significantly, but I'm not willing to part with Alfie.

    For now I've deactivated Asynchronous Javascript as I want Alfie more.

    Hope you'll be helpful, as always.

    http://wordpress.org/plugins/alfie-wp-weather/

  2. appcuarium
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    Alfie WP Weather already IS async, so it doesn't need any tweaking from this point of view. It will always load, without blocking the page. So maybe a possible fix is you should not include Alfie WP Weather in that plugin's list of async loading scripts. As a side comment, an automated script for async loading the scripts is a bad idea, as there are many things to take into account when a page is drawn. Async should be done manually, because every site has its own needs, and loaded automatically if it doesn't imply page elements drawing ( a manual tweak is needed to do so ).

    Best regards.
    The Alfie Team

  3. jsmi
    Member
    Posted 1 year ago #

    Hi,

    Thanks for the prompt response. Obviously, I'm not looking to async Alfie's scripts, but my website's other javascript files. Other than the Alfie issue, everything is working fine for me with that plugin.

    I tried whitelisting 2 instances of both alfie-weather.js and alfie-weather.min.js, that are in the js folder, but it didn't work for me.

    Is there any script file I'm missing other than these two? Could you please look into the issue, if you don't mind?

  4. jsmi
    Member
    Posted 1 year ago #

    Resolved. I'd to list the files inside commas in the whitelisting box provided by the plugin. Whitelisted those 4 js files properly, and now everything is working well. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic