WordPress.org

Ready to get started?Download WordPress

Forums

WP SlimStat
[resolved] Javascript error 'Object does not support..' with IE7/IE6 (7 posts)

  1. Ov3rfly
    Member
    Posted 1 year ago #

    If WP SlimStat 2.8.3 is used on a site which is visited with IE7 or IE6, it causes a javascript error in the browser of the visitor: Object does not support this property or method...

    With Companion.JS and Script Debugger for Windows and by replacing wp-slimstat.js with dev/wp-slimstat.js I was able to track down the problem, line 70:

    for (i in navigator.plugins) {

    Screenshot: http://i.imgur.com/7Pbuq.gif

    Obviously IE7 and below does not support access to navigator.plugins in this way, a quick google search seems to support this theory:

    http://www.matthewratzloff.com/blog/2007/06/26/detecting-plugins-in-internet-explorer-and-a-few-hints-for-all-the-others/
    http://www.aspfree.com/c/a/windows-scripting/detecting-plugins-in-internet-explorer/
    http://www.ifadey.com/2011/09/browser-plugin-detection/
    ...

    http://wordpress.org/extend/plugins/wp-slimstat/

  2. camu
    Member
    Plugin Author

    Posted 1 year ago #

    I'm sorry, but if you had cared to read the plugin's homepage, you would have noticed that WP SlimStat is not compatible with those versions of Internet Explorer. Not even Microsoft supports IE6/IE7 anymore ;)

    Cheers,
    Camu

  3. Ov3rfly
    Member
    Posted 1 year ago #

    The only IE related note I found on the plugin homepage is this:

    Browser Compatibility
    
    WP SlimStat uses HTML5 canvases to display its charts. This approach is not compatible with Internet Explorer 8 or older, so you're encouraged to upgrade your browser.

    End users and many companies don't care about what Microsoft supports anymore or not, I observe a 20-30% share of IE6/IE7 on real world WordPress sites which have an international target-group.

    Adding a simple try..catch statement around the navigator.plugins code would solve the above described problem.

    Here is a quick-fix for interested readers:
    1. Replace wp-slimstat.js with dev/wp-slimstat.js
    2. Apply the following change, starting at line 66:

    _detect_single_plugin : function (plugin_name) {
    	var plugin, haystack, found, i, j;
    
    	try {	// added to avoid script error on older IE
    		if (navigator.plugins) {
    			for (i in navigator.plugins) {
    				haystack = '' + navigator.plugins[i].name + navigator.plugins[i].description;
    				found = 0;
    
    				for (j in SlimStat._plugins[plugin_name].substrings) {
    					if (haystack.indexOf(SlimStat._plugins[plugin_name].substrings[j]) != -1) {
    						found++;
    					}
    				}
    
    				if (found == SlimStat._plugins[plugin_name].substrings.length) {
    					return true;
    				}
    			}
    		}
    	} catch (e) {}	// added to avoid script error on older IE
    	return false;
    },

    Actually there is already a function _detect_single_plugin_ie() in WP Slimstat javascript (line 88) to detect plugins on old IE, but it is never used because the script fails before, because of above described problem...

  4. camu
    Member
    Plugin Author

    Posted 1 year ago #

    Good catch. I will implement this fix in my next release, thank you for your feedback :)

    Camu

  5. camu
    Member
    Plugin Author

    Posted 1 year ago #

    This has been fixed in version 2.8.4, which should be released later today :) Please let me know if it works as expected.

    Cheers,
    Camu

  6. Ov3rfly
    Member
    Posted 1 year ago #

    FYI, 2.8.4 works as expected, no more javascript error in IE6/IE7.

  7. camu
    Member
    Plugin Author

    Posted 1 year ago #

    YAY! Hey a vote for my plugin would be a nice way to say thank you!

    Cheers,
    Camu

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.