How to open link http://facebook.com on webview Android?

I try open http://facebook.com but my webview open and display link http://m.facebook.com.

This my code.

protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.webview);

        webviewv=(WebView) findViewById(R.id.webView1);

        webviewv.setWebViewClient(new WebViewClient());

        webviewv.getSettings().setJavaScriptEnabled(true);

        webviewv.loadUrl("http://facebook.com");

}

Anybody?

Upvotes: 1

Views: 1449

Answers (1)

PCoder
PCoder

Reputation: 2185

You probably need to fake the User-Agent parameter for your WebView. Websites use it to distinguish the client.

webviewv.getSettings().setUserAgentString("Mozilla/6.0 (Windows NT 6.2; WOW64; rv:16.0.1) Gecko/20121011 Firefox/16.0.1");

Upvotes: 3

Related Questions