WordPress.org

Ready to get started?Download WordPress

Forums

Use Google Libraries
[resolved] Link to SWFOBJECT.js broken (12 posts)

  1. spabav
    Member
    Posted 3 years ago #

    Hi I am using "use google libraries" for quite some time now.

    Doing a pingdom check on my site, I see that it calls the swf from google, but the link is broken.

    The link is:
    http://ajax.googleapis.com/ajax/libs/swfobject//swfobject.js

    If you look, you will see it does link to a double // before the word swfobject.js , and therefore the link does not work.

    This makes the load not working.

    It does not matter for my site, but its something which could be fixed easily , i guess.

    Would be nice if you could help.

  2. Jason Penney
    Member
    Plugin Author

    Posted 3 years ago #

    I just tested it on a site with only stock WordPress and Use Google Libraries.

    The link I get is:
    https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js

    Is some other plugin re-registering swfobject without it's version info?

  3. spabav
    Member
    Posted 3 years ago #

    Thanks Jason,
    I guess that is the problem then.

    Unfortunately it is "nearly" impossible for me to figure out which plugin it could be, since i got quite a bunch (46) running.

    So far, its funny since it seems it does not affect my site.

    Anyway, thanks for your help.

  4. Jason Penney
    Member
    Plugin Author

    Posted 3 years ago #

    If you have shell access (and if it's a UNIX/Linux based account) it should be fairly easy to figure out an least what plugins reference swfobject:

    $ cd wp-content/plugins
    
    $ grep -Rl swfobject .

    (that's a lowercase L on the grep command, not the number one)

    Or, if you feel like posting the list I can see if any jump out at me.

  5. spabav
    Member
    Posted 3 years ago #

    Hi Jason,
    thanks for your quick reply.

    I think i found the plugin.
    The JW Player plugin for wordpress is creating a swfobject callup on several occasions inside the plugin.

    The strange thing to me, it looks like it is calling the swfobject, directly with the right version number 2.2 and it is calling it directly from googleapis.

    Not sure if this causes the "wrong swfobject" callup, but it is the only plugin i use, with the swfobject in source.

    Hope you can find what is causing the problem.

    Thanks a lot for your help in advance.

  6. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    Sorry for the delay in getting back to you. The issue is that JW Player is calling wp_*_script functions outside of a hook, in the main body of the plugin, which isn't supported by WordPress.

    JW Player should use init for the wp_deregister and wp_register calls and wp_enqueue_scripts or admin_enqueue_scripts for the wp_enqueue_script calls as documented in the Codex.

    Also JW Player doesn't check what version of swfobject WordPress core expects to load and instead hard-codes a specific version, which may cause problems in future.

  7. JW Player
    Member
    Posted 2 years ago #

    Hey guys,

    Thanks for posting the results of your investigation. SWFObject is only used as a fallback for users using older versions of the player. The intent is that the user have the JW Embedder installed (this is handled by the setup page included with the plugin).

    However, I will look into correcting the placement of the script registration calls.

    Thanks.

  8. scottdaris
    Member
    Posted 2 years ago #

    I am also getting the broken Google CDN link with the double forward slashes:

    http://ajax.googleapis.com/ajax/libs/swfobject//swfobject.js

    What would the final solution be then? I can't disable the "JW Player Plugin for WordPress" because all my videos depend on it, yet I'd like to keep "Use Google Libraries" active. In the JW Player setup and options (in WP) I don't see any preference to embed the .js or not. What's the best practice for this type of situation? Thanks :D

  9. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    Besides the registration calls being in the incorrect location in 'JW Player', they are also missing the version parameter, so 'Use Google Libraries' doesn't really stand a chance of working correctly at that point.

    I'd suggest that 'JW Player' just enqueue SWFObject, rather than assume it's the only plugin using this WP core javascript. If the user has 'Use Google Libraries' then it will load from google, if not it will load from the WordPress install.

    Or the 'JW Player' dev(s) could look at how 'Use Google Libraries' leaves the version string registered correctly, but doesn't append '?version=x.y' to the URL without breaking things, which is what assume they were trying to do by removing the version.

    If you want things to work right now, disable UGL, or modify JWP until it's fixed.

  10. scottdaris
    Member
    Posted 2 years ago #

    Thanks for your response, Jason. Could you tell me what code to use in the JWP file (and which file) so I can keep using UGL? I'm a javascript beginner – more a designer type of guy :)

  11. JW Player
    Member
    Posted 2 years ago #

    @Jason,

    The next version (coming out shortly) will be changed to enqueue swfobject.

    Thanks.

  12. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    I just looked at the code, and it seems like this is fixed in JW Player, so I'm marking this resolved. Let me know if you're still having issues.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic