Uploaded image for project: 'Guacamole'
  1. Guacamole
  2. GUACAMOLE-164

Downstream modifications to client template can cause fitVisibleArea() to fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • 0.9.10-incubating
    • None
    • guacamole
    • None

    Description

      There is a problem when the Guacamole application is not occupying the whole window and there are some elements inserted above Guacamole application. The issue can be seen in Firefox and possible in other browser, because the available height is not calculated in a cross-browser way.

      guacViewport directive calculates browser area height and based on the result sets height of the viewport. The calculation is made in fitVisibleArea() function, in the following line:

      var scrollHeight = document.body.scrollHeight;
      

      However, scrollHeight does not return same values cross-browser. In Chrome, it works as expected (from the Guacamole perspective), but different value is returned in Firefox. Different behaviour is not visible when the Guacamole client is occupying the whole window, only when there are some elements above.

      I have fixed the problem by calculating the height in guacViewport using function from here: http://james.padolsey.com/snippets/get-document-height-cross-browser/

      function getDocHeight() {
          var D = document;
          return Math.max(
              D.body.scrollHeight, D.documentElement.scrollHeight,
              D.body.offsetHeight, D.documentElement.offsetHeight,
              D.body.clientHeight, D.documentElement.clientHeight
          );
      }
      

      Further details on the cross-browser issue can be found here:

      http://stackoverflow.com/questions/1145850/how-to-get-height-of-entire-document-with-javascript
      http://james.padolsey.com/snippets/get-document-height-cross-browser/

      Attachments

        1. firefox-guac.png
          47 kB
          Marko Nikolić

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mnikolic Marko Nikolić
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: