2013-06-13 4 views
2

휴대 기기에서 내 GWT 앱의 검색 주소창을 숨기려고합니다. 내 모바일 코드에서 아래 JSNI 함수를 호출하고 있지만 작동하지 않습니다. 당신이 생각할 수있는 솔루션은 JQuery를 포함하지 않습니다.GWT : 휴대 기기에서 주소창 숨기기

public static native void hideBar() 
/*-{ 
    $($doc).ready(function() { 
     function hideAddressBar() { 
      if($doc.documentElement.scrollHeight < $wnd.outerHeight/$wnd.devicePixelRatio) { 
       $doc.documentElement.style.height = ($wnd.outerHeight/$wnd.devicePixelRatio) + "px"; 
      } 
     } 

     $wnd.addEventListener("load", function() { hideAddressBar(); }); 
     $wnd.addEventListener("orientationchange", function() { hideAddressBar(); }); 
    }); 
}-*/; 

답변

3

fullscreen 대신 앱을 만들면 어떨까요?

다른 구현 (webkit 대 gecko 접두사, 메서드 명명법이 W3C 표준과 다르다.)에 대한 설명이 필요 하겠지만, 이는 여러분의 경우에있는 것처럼 보입니다.

대신 hideAddressBar()

는 ruffly이 일을하는 goFullScreen() 있습니다

function goFullScreen() { 
    var docElm = $doc.documentElement; 
    if (docElm.requestFullscreen) { 
     docElm.requestFullscreen(); 
    } else if (docElm.mozRequestFullScreen) { 
     docElm.mozRequestFullScreen(); 
    } else if (docElm.webkitRequestFullScreen) { 
     docElm.webkitRequestFullScreen(); 
    } 
} 

이 MDN에 Using Fullscreen Mode 및 hacks.mozilla.org에서도 Using the fullscreen API in web browsers를 참조하십시오.

로버트 먼 (robnyman)의 this useful gist도 빠르게 확인하십시오.