Search code examples
javajavascriptgwtjsni

gwt jsni document.documentElement.style.height


I try to call the code from this link https://stackoverflow.com/a/9100406/942113 with gwt jsni.

My method looks like

  public static native void hideAddressBar() /*-{
        if (document.documentElement.scrollHeight < $wnd.outerHeight * $wnd.devicePixelRatio) {
            document.documentElement.style.height = ($wnd.outerHeight * $wnd.devicePixelRatio) + 'px';
        }
        setTimeout($wnd.scrollTo(1, 1), 0);
  }-*/;

But when I call it, nothing happens.

My question: Isn't it possible to set the value of document.documentElement.style.height with gwt jsni?


Solution

  • Try referring to it as $doc instead of document

    Ref: http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html