• Resolved troyw2015

    (@troyw2015)


    Hi,

    I am using dFlip and have unfortunately had to enable the Siteground Speed Optimiser, in order to resolve several other issues. However, since enabling the PDF book no longer loads. Instead I get the message ‘Error: Set a Valid Document Source’.

    By turning off Combine JavaScript Files in Speed Optimiser, I resolve the issue, but alas, all my other woes reappear. So I have tried to exclude the JS files and excluded /plugins/dflip/assets/js/dflip.min.js however this does not resolve the issue.

    Having tried everything I know, I wonder if you can point me in the right direction to fix this?

    You’ll find the book in the ‘Take a sneak peek….’ section of the page

    Thanks

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author DearHive

    (@dearhive)

    Hi,

    We see that there is script missing after the thumb. with class df-shortcode-script

    <script class="df-shortcode-script" type="application/javascript">window.df_option_5413 = .................

    Looks like this inline script was merged or manipulated. Can you exclude df-shortcode-script in exclusions available. Maybe that will work,

    We tried adding Sigeground optimizer to our site. even though the code part was manipulated it was working; since it was loaded later. Whereas in you site there is an error in siteground-optimizer js so maybe that is causing execution block.

    siteground-optimizer…bc13ffa2574afb.js:2 Uncaught Error: No Usercentrics script ID "usercentrics-cmp" found

    Best Regards,
    DearHive

    Thread Starter troyw2015

    (@troyw2015)

    Hi,

    Are you able to tell me the handle for this Shortcode, so that I can exclude it from caching?

    Thanks

    Plugin Author DearHive

    (@dearhive)

    Hi,

    The shortcode is handled by a function shortcode in Class DFlip_ShortCode . This is in file inc/shortcodde.php

        add_shortcode( 'dflip', array( $this, 'shortcode' ) );

    Not sure how are going to exclude php functions in cache.

    For HTML cache, in other cache plugins like wp-rocket, excluding the script class df-shortcode-script works

    <script class="df-shortcode-script" type="application/javascript">window.df_option_5413 = .................
    Thread Starter troyw2015

    (@troyw2015)

    OK, so SiteGround are insisting there must be a Handle. I have followed their instructions to display the Handles in the HTML Inspector and tried excluding them all, but it has not worked. I really thought this Handle would do it, but it did not dflip-script

    The SiteGround Speed Optimiser Plugin does have a Manage General window, which has a fields labeled ‘Exclude from HTML Minification’. You suggested that WP Rocket has something similar, so I have added both DFlip_ShortCode and df-shortcode-script to Exclude from HTML Minification. But of course, this does not work either!

    I am at complete loss here. I have inherited your plugin that seemingly doesn’t use handles and a caching plugin that doesn’t support whatever it is you do use (which I can’t quite understand either to be honest). Surely I can exclude your plugin from caching somehow?

    Plugin Author DearHive

    (@dearhive)

    Hi,

    I too had a look at siteground plugin and it does have option to exclude files but not inline scripts.

    wp rocket/litespeed has ability to exclude both files and inline scripts.

    The handle they(siteground) are referring to is probably for registering script files. But in our case the issue is from inline scripts. Have you inquired how to exclude inline scripts? Or can you point me to their support thread( if it is wordpress.org)

    Best Regards,

    DearHive

    Thread Starter troyw2015

    (@troyw2015)

    I have just asked how to exclude inline scripts and am waiting response. Here is the thread;

    https://wordpress.org/support/topic/dflip-caching-issues/#post-18271007

    Thanks

    Thread Starter troyw2015

    (@troyw2015)

    They have come back with the following, which I implemented but it did not work;

    Hello,

    You can exclude inline scripts from being combined using the following filter. Here’s a code snippet, you can add to your functions.php file to do so:

    add_filter( 'sgo_javascript_combine_excluded_inline_content', 'js_combine_exclude_inline_script' );
    function js_combine_exclude_inline_script( $exclude_list ) {
      $exclude_list[] = 'first few symbols of inline content script';
    
      return $exclude_list;
    }

    Looking at the code, I think I need to add the ‘first few symbols of inline content script’. I tried df-shortcode-script but no good, so what are they?

    Thanks

    Thread Starter troyw2015

    (@troyw2015)

    The team at Siteground provided this code which appears to have fixed the issue by excluding all dFlip files.

    add_filter( 'sgo_javascript_combine_excluded_inline_content', 'js_combine_exclude_inline_script' );
    function js_combine_exclude_inline_script( $exclude_list ) {
    $exclude_list[] = 'df';
    return $exclude_list;
    }

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Error: Set a Valid Document Source’ is closed to new replies.