Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Ismail

    (@elhardoum)

    Hi @blair,

    Please discuss more on this issue, how does the widget break, and why you want to load the JS asynchronously ?

    The JavaScript the widget is using, is not saved in a .js file but it is included in the main PHP file because we wanted to use a PHP function there..

    Check out this SVN file for the plugin, search for “<script>” and that’s where you can find the script used to load this widget..

    Anyways, are you sure the not async. loaded JS is the problem behind the widget breaking for you? How many total posts do you have?

    Thread Starter Blair

    (@cbcbcb)

    Thanks. I’ll look into it.
    You want to load JS asynchronously to load your page faster and more efficiently.
    See: https://developers.google.com/speed/pagespeed/insights

    Thread Starter Blair

    (@cbcbcb)

    forgot this: By “break” I mean it fails to stop at the X number you choose to show and loads all on the page.

    Plugin Contributor Ismail

    (@elhardoum)

    Thank you for the optimization advice. Unfortunately I can’t throw the JavaSrcipt in a separate external file as a part of it includes a PHP function which won’t be executed once the file isn’t a .php one.

    The function is <?php echo tspf_default_post_count(); ?> : You can replace it with a number of your choice, then load the JS async.

    Once the plugin is updated, I am afraid you’ll do this process again.

    Thread Starter Blair

    (@cbcbcb)

    Unfortunately that method doesn’t work.

    Thread Starter Blair

    (@cbcbcb)

    If you use the “Async JS and CSS” plugin and choose to Load Javascript asynchronously, you can exempt the js for the TSPF in Exceptions.
    Placing these in the exceptions box appears to resolve this.
    jquery
    jquery.min.js

    Plugin Contributor Ismail

    (@elhardoum)

    @blair,

    Glad to hear you are resolved with the optimization trick.

    We will publish a new plugin that includes this top shared posts as one of its features, and it is not going to use any JS.

    Placing these in the exceptions box appears to resolve this.

    Marking as resolved – you did it ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘widget breaks when attempting to load javascript asynchronously’ is closed to new replies.