2

I think that title say all important, I want it to http://studiodamage.sweb.cz/.

My code:

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View rootView = inflater.inflate(R.layout.fragment_web, container, false);
    WebView webView = (WebView)rootView.findViewById(R.id.webview);
    webView.getSettings().setUserAgentString("Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/20 Safari/537.31");
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl("http://studiodamage.sweb.cz/");
    return rootView;
}
koca2000
  • 67
  • 12

2 Answers2

2

Assuming you meant to view website as a desktop site try:

webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setLoadWithOverviewMode(true);

OR

webview.getSettings().setUserAgent(1);//for desktop 1 or mobil 0. 

OR

Try something more desktop browser looking such as:

String ua = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0";
Sagar Pilkhwal
  • 3,998
  • 2
  • 25
  • 77
  • @SagarPilkhwal: Its not working webview.getSettings().setUserAgent(1);//for desktop 1 or mobil 0. – Vignesh Dec 27 '17 at 19:25
  • Which version u were used – Vignesh Dec 27 '17 at 19:25
  • @koca2000 : Can you please tell me in which version (android studio) its working. Because the same code is not working in android studio latest version 3.0.1 – Vignesh Dec 27 '17 at 19:34
  • I would like to know whether its a version upgraded issue or some other issues. – Vignesh Dec 27 '17 at 19:35
  • @ASV It would be API version problem rather than android studio. I was developing in eclipse when I asked this question. – koca2000 Dec 28 '17 at 15:44
  • Okay, Actually the same problem am facing in android studio webview so that I asked . – Vignesh Dec 28 '17 at 15:47
  • This is my issue please check this once https://stackoverflow.com/questions/47946658/android-webview-desktop-website-wont-work/47958325#47958325 – Vignesh Dec 28 '17 at 15:49
0
 webView.getSettings().setUserAgentString("1"); //for desktop 1 or mobile 0.

Now this is in 12/2021

ricardoNava
  • 685
  • 1
  • 7
  • 26