Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1411180

    Hi there,

    On my website, I have a popup. Because of this, some css and js files are being duplicated. This can be seen in GTMetrix (Avoid enormous network payloads): https://gtmetrix.com/reports/welding-alloys.zerobox.co.za/y3XRcP6O/

    I would simply like to add some code in my functions.php file to dequeue these styles or scripts if a duplicate occurs (if in an iframe).
    However, I am unable to get the correct handle for the js and css files I wish to dequeue.

    See example of files that appear twice due to the iframe as explained above:
    1. https://welding-alloys.zerobox.co.za/wp-content/uploads/dynamic_avia/avia-merged-styles-7fe77e298b503a9a07f5ff4ad5c43d89—649173dc020ff.css
    2. https://welding-alloys.zerobox.co.za/wp-content/uploads/dynamic_avia/avia-footer-scripts-ad02dcb999be2087336cb42c0931e3ed—649173e2c4054.js

    I have tried to print_r the results of global $wp_styles; and global $wp_scripts; , but I don’t seem to find any of the above in the array, I would like to know the handle of the above files, so I can dequeue them. Here is what I tried (using the ids) but it did not work:

    if (window!=window.top) {

    /* I’m in an iframe! – Dequeue styles and scripts*/
    wp_dequeue_style( ‘avia-merged-styles’ );
    wp_dequeue_script(‘avia-head-scripts’);
    wp_dequeue_script(‘avia-footer-scripts’);
    }
    *It seems like the handles I have used on wp_dequeue_style and wp_dequeue_script are incorrect? Please advise on how I can find the handles/ dequeue specific css and js as mentioned above.

    Thanks.

    #1411457

    Hey Rustum,

    Thank you for the inquiry.

    It is possible that one of the plugins that you installed is causing the duplicated scripts and stylesheets. Please try to do the following steps:

    1.) Toggle the Enfold > Performance > File Compression settings. Enable and disable them, then make sure to purge the cache.

    2.) Alternatively, you can completely disable the compression settings and consider looking for another compression plugin such as Autoptimize or BWP Minify to handle the script and stylesheet optimization.

    Let us know if this helps.

    Best regards,
    Ismael

    #1411464

    Hi Ismael,
    That is correct. We use a plugin called Popup by Supsystic. Basically, the popup I referred to opens in an iFrame hence the duplicates stylesheets and scripts.
    Do you have a solution for this? to avoid duplicates of the stylesheets and scripts when opening on iFrame, with the frame content being from the same site?
    Please advise.

    #1411574

    Hi,
    Unfortunately you can not control the objects inside an iframe, you would need to dequeue the items for the page that is going to be used as an iframe before it is used.
    So your iframe page would only be used for the popup and not directly accessed.
    Since your popup is only a contact form why not add it to your page hidden and show in a lightbox popup?

    Best regards,
    Mike

    #1411840

    Thanks Mike,

    We decided to used an iframe instead of a lighbox popup because it was necessary for tracking conversions. > The iframe was basically a gravity form on a page and then we track the conversions of the confirmation/thank you page.

    But based on your suggestion, I guess it will just be easier to use a lightbox popup as you suggested to add a link in the popup to the page with the contact form.

    #1411864

    Hi,
    Sounds good, shall we close this thread then?

    Best regards,
    Mike

    #1411928

    Yes thank you. You may close the thread.

    #1411930

    Hi Rustum,

    We’re glad to hear that :)
    Thanks for using Enfold and have a great day!

    Best regards,
    Nikko

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘How to dequeue enfold css and js files’ is closed to new replies.