0

I researched a lot but not found anything working, i want my webview to open a desktop version not a mobile version of a html page... what is the way to do that?

this is my code:

 protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.jobs);

        getWindow().setFeatureInt(Window.FEATURE_PROGRESS,
                Window.PROGRESS_VISIBILITY_ON);
        getActionBar().setDisplayHomeAsUpEnabled(true);
        jwv = (WebView) findViewById(R.id.jobsweb);

        jwv.loadUrl("https://2ce74af0d8de8783b91cdd315eeba0340a4b9277.googledrive.com/host/0B2sDUzNeIK0KODB0ZDRMVjFPaFE/Jobs.html");
        String ua = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0";
        jwv.getSettings().setUserAgentString(ua);
        jwv.setWebViewClient(new WebViewClient()
        {

            public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                 Toast.makeText(Jobs.this, "Oh no! " + description, Toast.LENGTH_SHORT).show();
               }
             });

        final Activity MyActivity = this;

        jwv.setWebChromeClient(new WebChromeClient() {
            public void onProgressChanged(WebView view, int progress) {
                MyActivity.setTitle("Loading...");

                MyActivity.setProgress(progress * 100);
                if (progress == 100)
                    MyActivity.setTitle("Jobs");
            }

        });
    }
Puneet Kushwah
  • 1,495
  • 2
  • 17
  • 35

1 Answers1

0

your problem is there :

String ua = "Mozilla/5.0 (Linux; U; Android 3.1; en-US; GT-P7500 Build/HMJ37) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Desktop Safari/534.13";
 mWebview.getSettings().setUserAgentString(ua);

its an android 3.1 user-agent !

Use this user-agent instead:

String ua = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0";
YFeizi
  • 1,498
  • 3
  • 28
  • 50
  • I think the u-a that you choose is wrong ! review it carefuly and try some other user-agent ! i cant help anymore – YFeizi Jan 28 '15 at 13:04