• M Designs

    (@mcmorrisdesigns)


    The script is loaded unconditionally(it loads in modern browsers when it should only be loading in IE6-8).

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

    (@ramoonus)

    not true, the javascript detects on the first lines if its the right browser

    No, it’s true. The plugin loads the script everywhere.

    From selectivizr/selectivizr.php:

    // init
    function rw_selectivizr() {
        wp_enqueue_script('selectivizr',plugins_url( '/js/selectivizr.js' , __FILE__ ), array(), '1.0.b3' );
    }
    // load
    add_action('wp_head', 'rw_selectivizr');

    The script is what detects the browser.

    From selectivizr/js/selectivizr.js:

    (function(win) {
    
        // Determine IE version and stop execution if browser isn't IE. This
        // handles the script being loaded by non IE browsers because the
        // developer didn't use conditional comments.
        var ieUserAgent = navigator.userAgent.match(/MSIE (\d+)/);
        if (!ieUserAgent) {
            return false;
        }

    I think @m Designs means that the script shouldn’t even be loaded unless it’s needed. I agree. Why load yet another script if it’s not needed, even if it does die right away? Perhaps using global $is_IE along with a condition in the php file would be the solution…

    Plugin Author Ramoonus

    (@ramoonus)

    I used the Original javascript as provided
    https://github.com/keithclark/selectivizr

    Plugin Author Ramoonus

    (@ramoonus)

    I`m working on a new version;
    https://github.com/Ramoonus/Powerpack

    Looks nice, but it’s too much for me. I like this plugin 🙂

    This is what I did in selectivizr.php:

    function rw_selectivizr() {
    	global $is_IE;
    	if ($is_IE) {
    		wp_enqueue_script('selectivizr',plugins_url( '/js/selectivizr.js' , __FILE__ ), array(), '1.0.b3' );
    	}
    }

    Can you update the plugin with this code (or similar), please?

    Plugin Author Ramoonus

    (@ramoonus)

    I`m working on a new version of this plugin on GitHub
    https://github.com/Ramoonus/Powerpack

    I will not edit the current version

    Plugin Author Ramoonus

    (@ramoonus)

    I also found a more neat approach to the is_IE

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

The topic ‘Sloppy implementation’ is closed to new replies.