• Resolved Neolo7

    (@neolo7)


    There is some JS conflict, which I’m unable to solve. Randomly appears when clicking the different links on the website. For example go to home page in fresh browser tab, and click very first album, it gets stuck loading with console output, apparently related to plugin. Refreshing the page or clicking Back button and clicking same link again passes it.

    jquery.js?ver=1.12.4-wp:4 Uncaught ReferenceError: _svqSettings is not defined
    at eval (eval at <anonymous> (jquery.js?ver=1.12.4-wp:2), <anonymous>:4:28)
    at eval (eval at <anonymous> (jquery.js?ver=1.12.4-wp:2), <anonymous>:122:3)
    at eval (<anonymous>)
    at jquery.js?ver=1.12.4-wp:2
    at Function.globalEval (jquery.js?ver=1.12.4-wp:2)
    at text script (jquery.js?ver=1.12.4-wp:4)
    at Wb (jquery.js?ver=1.12.4-wp:4)
    at x (jquery.js?ver=1.12.4-wp:4)
    at c (jquery.js?ver=1.12.4-wp:4)
    at Object.send (jquery.js?ver=1.12.4-wp:4)
    (anonymous) @ VM91:4
    (anonymous) @ VM91:122
    (anonymous) @ jquery.js?ver=1.12.4-wp:2
    globalEval @ jquery.js?ver=1.12.4-wp:2
    text script @ jquery.js?ver=1.12.4-wp:4
    Wb @ jquery.js?ver=1.12.4-wp:4
    x @ jquery.js?ver=1.12.4-wp:4
    c @ jquery.js?ver=1.12.4-wp:4
    send @ jquery.js?ver=1.12.4-wp:4
    ajax @ jquery.js?ver=1.12.4-wp:4
    n._evalUrl @ jquery.js?ver=1.12.4-wp:4
    Ga @ jquery.js?ver=1.12.4-wp:3
    append @ jquery.js?ver=1.12.4-wp:3
    complete @ script.js?ver=1.3.0:27
    GetScripts.fetch @ script.js?ver=1.3.0:55
    showNewContent @ script.js?ver=1.3.0:379
    success @ script.js?ver=1.3.0:487
    i @ jquery.js?ver=1.12.4-wp:2
    fireWith @ jquery.js?ver=1.12.4-wp:2
    x @ jquery.js?ver=1.12.4-wp:4
    c @ jquery.js?ver=1.12.4-wp:4
    XMLHttpRequest.send (async)
    send @ jquery.js?ver=1.12.4-wp:4
    ajax @ jquery.js?ver=1.12.4-wp:4
    loadSite @ script.js?ver=1.3.0:472
    linkClickEvent @ script.js?ver=1.3.0:436
    dispatch @ jquery.js?ver=1.12.4-wp:3
    r.handle @ jquery.js?ver=1.12.4-wp:3

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author team-ok

    (@team-ok)

    I think this happens when the content is loaded on demand (via ajax).
    My plugin loads scripts only when the shortcode is actually used by calling default wp functions that load these scripts in the footer.
    Your theme seems to have a mechanism that loads these scripts into the footer even when it’s an ajax call, but there must be something wrong with the order of the scripts that get loaded. So one script calls a variable that is not defined yet(ReferenceError), because the scripts are loaded in the wrong order.

    I will try to find a solution for you but again it’s hard to debug without seeing your scenario.

    Thread Starter Neolo7

    (@neolo7)

    I have provided a link in the first post, to see the scenario. Thanks.

    Plugin Author team-ok

    (@team-ok)

    There are some strange things going on: when you click on the first link of your main page, the scripts of my plugin seem to be included just right (they appear in the html source of the page), but for some reason some of them are removed afterwards (they don’t appear in the dom tree of DevTools).
    There is a function in your theme’s main script that should handle the loading of scripts when content is fetched via ajax. I guess there’s something going wrong here. That would explain why everything’s fine when you reload the page or open it directly (no ajax involved).
    There’s not much I can do here, but inside of the main script of your theme there’s a check if the link that was clicked on has the class “no_ajax” and if it’s there, the page is loaded without ajax and everything is working. I tested it by simply adding this class to the <a>-element in DevTools, but I guess there is an option in the admin area or on your page edit screen for doing that saying “don’t load this page via ajax” or something similar.

    As a last resort I could make a special version of the plugin that loads its scripts on every page (not only when the shortcode is actually used). Maybe this would avoid the error, but please try the other solution first.

    Thread Starter Neolo7

    (@neolo7)

    Thank you for checking. The only option I have to switch is a spinning loader type: on-load or on DOM ready. There is nothing else available to change. I’d be glad to modify theme manually if I knew what to modify.
    Second version of plugin, or maybe just an additional option in current plugin to force load the scrip on every page, would be helpful for those people with such themes. Or perhaps it’s possible to define the post types on which to load always? In my case posts are “Album” types. Thanks.

    Plugin Author team-ok

    (@team-ok)

    The docs of your theme say there’s an option in the customizer to disable ajax functionality or to enter urls that shouldn’t be loaded via ajax:
    http://apollo13.eu/docs/photon/#ajax_settings
    Could you please try if this solves your issue?

    Some of the scripts of my plugin need to be loaded dynamically (e.g., when the embed feature is deactivated for a post), so this can’t be a general solution.

    • This reply was modified 6 years, 11 months ago by team-ok.
    Thread Starter Neolo7

    (@neolo7)

    It appears to be helped. I turned off Ajax loading and problem has gone away. No visual impact though. So your plugin isn’t really compatible with ajax-enabled themes. If any workaround can be done, it will be highly appreciated. Thank you.

    Plugin Author team-ok

    (@team-ok)

    I’m glad it’s working now.
    The plugin only uses default wp functions like wp_enqueue_script and wp_localize_script, so there’s nothing special on my plugin’s side. If a theme has an ajax-loading feature, it’s up to the theme to handle dynamic script loading. This is where your theme seems to fail.
    There are scripts my plugin uses that have to be loaded in the footer, because they overwrite default settings of wp, which are also loaded in the footer, so they can’t be simply embedded in the content (the Ajax response).

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

The topic ‘Uncaught ReferenceError: _svqSettings is not defined’ is closed to new replies.