Discussion Using Name.Ctrl Presence Icons and Scrolling

  • Wednesday, July 20, 2011 11:18 AM
     
      Has Code

    This is an informational post for those developers who may be trying to implement the Name.Ctrl Communicator Presence ActiveX control as demonstrated in the example available at http://www.microsoft.com/download/en/details.aspx?id=10003. A small fix is required, at least for IE8, for larger pages that may require vertical or horizontal scrolling if the Accelerator is to be properly displayed. Without this fix, the JavaScript call to the ActiveX ShowOOUI method will use an invalid X or Y coordinate and will attempt to render the control off of the visible part of the screen.

    To correct this, open NameControl.js. Locate the PresenceControlGetOOUILocation function. After the Try/Catch block, change the assignments of the properties of the objRet Object instance to the following:

    objRet.oouiX = oouiX - document.documentElement.scrollLeft;
    
    objRet.oouiY = oouiY - document.documentElement.scrollTop;
    
    

    Older versions of IE may need to rely on the document.body.scrollTop/scrollLeft properties in order to achieve the desired result. As of IE8, these older properties always return 0.


All Replies

  • Monday, September 05, 2011 11:48 AM
     
     

    Hello there.

    I still have the same problem, and this fix does not work, when the page is inside the iFrame. Anyone knows how to get the right co-ordinates for this?

    Thank you.


    Pinaki
  • Monday, April 30, 2012 11:30 PM
     
     

    If your iFrame contains a page hosted in the same domain as the parent then you can access the DOM of the parent page. I'm guessing you'll need to offset against the scrollLeft and scrollTop of the iFrame's documentElement.

    If your iFrame contains a page hosted on a different domain/subdomain to the parent and you are able to edit both the container and the frame then you'll need to use a method like this: http://stackoverflow.com/questions/153152/resizing-an-iframe-based-on-content

    If your iFrame contains a page hosted on a different domain/subdomain to the parent and you can't edit both pages then this may be difficult to achieve.