Jonathan Hawkes
Jonathan Hawkes

Reputation: 953

Hide the URL bar in Android Webkit

This doesn't seem to work in jqTouch or iUI. But I know it's possible because it works on my Droid when I go to deviantart.com . Anyone know how to do it?

Thanks!

Upvotes: 2

Views: 5195

Answers (3)

wyo9089
wyo9089

Reputation: 37

if you are using a webkit i'm assuming that you have created an on create method, create a class below it that looks something like this

private class CallBack extends WebViewClient
{
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url)
    {

            browser.loadUrl(url);
            return true;

    }   
}

declare a webviewclient, and a webview when creating the parent class

WebView browser;
WebViewClient browserClient;

that should keep your app from opening an external browser.

Went through the same problem when i was starting my app project, so I hope this helps

Upvotes: 1

Corrado Fiore
Corrado Fiore

Reputation: 11

Have you tried firing the function on window.load and on pageAnimation events?

// Hide URL bar when loading the first page
$(window).load( function() {
    setTimeout(scrollTo,200,0,1);
});

// ...and on every subsequent request handled by jQTouch
$(document).delegate("body", "pageAnimationStart pageAnimationEnd", function() {
    setTimeout(scrollTo,200,0,1);
});

Upvotes: 1

Jonathan Hawkes
Jonathan Hawkes

Reputation: 953

Ok, I'm gonna answer my own question here. I added this bit of jQuery...

$(document).ready(function() { setTimeout(scrollTo,200,0,1) });

The timeout appears to be necessary. On my Droid, the document is not yet ready to scroll when the DOMContentLoaded event is fired.

Upvotes: 3

Related Questions