1

Topic: Problem with iBrowser Plugin in IE9

Hey there!

I'm running into a problem with the iBrowser Plugin for TinyMCE. Only in Internet Explorer 9 when I click the icon from the toolbar nothing happens, the plugin is not showing up.

The console tells me this error message:

SCRIPT5007: Unable to set value of the property 'isMSIE': object is null or undefined
editor_plugin.js, line 23 character 5

Here is the code, I've no idea where to go. Your help would really be appreciated.

/**
* $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
*
* @author Moxiecode
* @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
*/

ib = null;
           
(function() {
    tinymce.create('tinymce.plugins.IBrowserPlugin', {
        init : function(ed, url) {
            // load common script
            tinymce.ScriptLoader.load(url + '/interface/common.js');
           
            // Register commands
            ed.addCommand('mceIBrowser', function() {
                var e = ed.selection.getNode();

                // Internal image object like a flash placeholder
                if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) {return}

                ib.isMSIE  = tinymce.isIE;
                ib.isGecko = tinymce.isGecko;
                ib.isWebKit= tinymce.isWebKit;
                ib.oEditor = ed;
                ib.editor  = ed;
                ib.selectedElement = e;                   
                ib.baseURL = url + '/ibrowser.php';   
                iBrowser_open();
            });

            // Register buttons
            ed.addButton('ibrowser', {
                title : 'iBrowser',
                cmd :     'mceIBrowser',
                image:     url + '/interface/images/tinyMCE/ibrowser.gif'
            });
           
            // Add a node change handler, selects the button in the UI when a image is selected
            ed.onNodeChange.add(function(ed, cm, n) {
                cm.setActive('ibrowser', n.nodeName == 'IMG');
            });
        },

        getInfo : function() {
            return {
                longname :     'iBrowser',
                author :     'net4visions.com',
                authorurl : 'http://net4visions.com',
                infourl :     'http://net4visions.com/ibrowser.html',
                version :     '1.4.0'
            };
        }
    });
   
    // Register plugin
    tinymce.PluginManager.add('ibrowser', tinymce.plugins.IBrowserPlugin);
})();

Greetings

2

Re: Problem with iBrowser Plugin in IE9

Obviously you expect an already existing object "window.ib" to work with. But in the very first line (after all that comment stuff) you define "window.ib" as "null" (just using "ib" is the same as "window.ib").

I strongly suggest you create "ib" not as a "global" object (i.e. a property of window) but as a property of your editor instead. Properly initialize the object and then even IE should be happy.

Greetings from Germany,

Felix Riesterer.
(-> about me and this forum <-)

3

Re: Problem with iBrowser Plugin in IE9

Hey Felix

Thank you very much for your reply and time. Unfortunately I've no idea how to initialise this, do you have a hint for me?

Thank you very much!

Greetings

eXe

4

Re: Problem with iBrowser Plugin in IE9

da.eXecutoR wrote:

Unfortunately I've no idea how to initialise this,

Does this mean you've just copypasted your code until it "worked"?

da.eXecutoR wrote:

do you have a hint for me?

1.) remove the line "ib = null;" completely.
2.) insert the following before the line "ib.isMSIE  = tinymce.isIE;":
    var ib = new Object();

Greetings from Germany,

Felix Riesterer.
(-> about me and this forum <-)

5

Re: Problem with iBrowser Plugin in IE9

Hey Felix

Thank you very much for your answers. I didn't wrote this plugin by myself, I just support website where this is integrated and now, under IE9 it only shows up in compatibility mode.

Because this plugin doesn't seem to be still developed I need to fix it by my own, but I'm more on php side as on this.

So your hint worked a bit ;-)

Now I got this error:

SCRIPT5009: 'iBrowser_open' is undefined
editor_plugin.js, line 30 character 5

As I see this function realy doesn't exist in this js file but it works in Firefox, so where's the cheese?

Thank you Felix!

6

Re: Problem with iBrowser Plugin in IE9

Ouhh... I found out the bug. It wasn't ib = null;

The error was here:

tinymce.ScriptLoader.load(url + ‘/interface/common.js’);

Changing to:

tinymce.ScriptLoader.add(url + ‘/interface/common.js’);
tinymce.ScriptLoader.loadQueue();

Now it works, thank you Felix!