Hirak Chhatbar
Hirak Chhatbar

Reputation: 3181

Facebook fan page using webview

In my app, i am using webview. It is basically intended for my fan page. But as it is a webview, users can navigate at other places too. Is it illegal to do so? I mean making a facebook page in a webview? Will it create any copyright issues?

tC = (WebView) findViewById(R.id.tcWV);
    tC.getSettings().setJavaScriptEnabled(true);
    tC.loadUrl("https://touch.facebook.com/hahacricket");
    tC.setFitsSystemWindows(true);
    tC.setWebViewClient(new tCWVClient());
    tC.canGoBack();
    tC.canGoForward();

The other question I want to ask is how can I prevent users to go to the links other than my page.

@Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        view.loadUrl(url);
        Log.d("URL", url);
        return true;
    }

Upvotes: 0

Views: 129

Answers (1)

Varavut Lormongkol
Varavut Lormongkol

Reputation: 341

If you want to prevent user got to another website you have to check for the url in shouldOverrideUrlLoading()

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if(url.startsWith("https://touch.facebook.com/hahacricket")){
        view.loadUrl(url);
    }
    return true;
}

Upvotes: 1

Related Questions