WordPress.org

Forums

JW Player for Flash & HTML5 Video
[Plugin: JW Player Plugin for WordPress] Swfobject duplicity (5 posts)

  1. brasofilo
    Member
    Posted 4 years ago #

    i'm using Kimili Flash Embed (could be any other) and Jw Player,
    and realized Swfobject was being double loaded

    is there a way, other than core editing, to halt JW Player from loading Swfobject?

  2. JW Player
    Member
    Plugin Author

    Posted 4 years ago #

    @brasofilo,

    Unfortunately there isn't a way to do so without editing the source. I can look into adding an option to turn it off in a future version.

    Sorry for the inconvenience.

  3. brasofilo
    Member
    Posted 4 years ago #

    gee, LongTail Video

    it's just a little issue
    for this great tool of yours, editing the core or having double swfobject are secondary details...

    thanks for stoping by

  4. Sandro Bilbeisi
    Member
    Posted 4 years ago #

    There is a very simple fix for the swfobject duplicity which all solves the query parameter issue and also improves caching and YSlow/PageSpeed score:
    The end result will be a single javascript with no url query parameter and no SSL mismatches.

    in jw-player-plugin-for-wordpress the file jwplayermodule.php
    replace line
    wp_enqueue_script("google-swfobject", "http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js");

    with:

    wp_deregister_script( 'swfobject' );
    wp_register_script( 'swfobject', 'http' . (is_ssl() ? 's' : '') . '://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js',NULL,NULL);
    wp_enqueue_script( 'swfobject' );

    *the second null parameter remove the url query parameter and improves caching and score

    then ,in kimili-flash-embed the file kml_flashembed.php

    this block of code (lines 86 to 90):

    if ( get_option('kml_flashembed_swfobject_source') == '0' ) {
    	wp_register_script( 'swfobject', 'http' . (is_ssl() ? 's' : '') . '://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js', array(), '2.2' );
    } else {
    	wp_register_script( 'swfobject', plugins_url('/kimili-flash-embed/js/swfobject.js'), array(), '2.2' );
    }

    becomes:

    if ( get_option('kml_flashembed_swfobject_source') == '0' ) {
    	wp_deregister_script( 'swfobject' );
    	wp_register_script( 'swfobject', 'http' . (is_ssl() ? 's' : '') . '://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js', array(), NULL );
    } else {
    	wp_register_script( 'swfobject', plugins_url('/kimili-flash-embed/js/swfobject.js'), array(), NULL );
    }

    cheers,
    Sandro Bilbeisi

  5. JW Player
    Member
    Plugin Author

    Posted 4 years ago #

    Hi Sandro,

    Thanks for your investigation. I'm working on another quick patch and will include your suggestion.

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • JW Player for Flash & HTML5 Video
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic