我尝试从这个链接调用代码https://stackoverflow.com/a/9100406/942113与gwt-jsni。
我的方法看起来像
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);
}-*/;
但当我这么说的时候,什么都没发生。
我的问题是:难道不能用gwt-jsni设置document.documentElement.style.height
的值吗?
尝试将其称为$doc
而不是document
参考编号:http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html