Roundcube Community Forum

 

Using RC inside iframe leads to errors

Started by FatherCarbon, September 26, 2009, 12:24:56 AM

Previous topic - Next topic

FatherCarbon

I'm trying to load Roundcube into an iframe, but when RC tries to perform actions on its own iframes (in program/js/list.js), I get this error:

$("#" + iframes[n].id) is null
var pos = $('#'+iframes[n].id).offset();

This is the part of list.js where it occurs:

// add listener for iframes
    var iframes = document.getElementsByTagName('iframe');
    this.iframe_events = Object();
    for (var n in iframes)
    {
      var iframedoc = null;
      if (iframes[n].contentDocument)
        iframedoc = iframes[n].contentDocument;
      else if (iframes[n].contentWindow)
        iframedoc = iframes[n].contentWindow.document;
      else if (iframes[n].document)
        iframedoc = iframes[n].document;

      if (iframedoc)
      {
        var list = this;
        [B]var pos = $('#'+iframes[n].id).offset();[/B]

        this.iframe_events[n] = function(e) { e._offset = pos; return list.drag_mouse_move(e); }

        if (iframedoc.addEventListener)
          iframedoc.addEventListener('mousemove', this.iframe_events[n], false);
        else if (iframes[n].attachEvent)
          iframedoc.attachEvent('onmousemove', this.iframe_events[n]);
        else
          iframedoc['onmousemove'] = this.iframe_events[n];

        rcube_event.add_listener({element:iframedoc, event:'mouseup', object:this, method:'drag_mouse_up'});
      }
    }

It's getting late and I'm so lost. There's nothing special to know about the parent page, it just has RC loaded in an iframe. I can login, then when it gets to the inbox, it gets these errors, and messages won't load, etc.

If anyone needs any more info, please let me know and I'll do my best to provide it. Thanks! :confused:

rosali

Regards,
Rosali