How to use webview as a browser in android application? -


url here

when load above url in application webview change http://m.allrecipes.com when load same url in browser url http://allrecipes.com.

is there way load normal url(http://allrecipes.com) in application webview without loading page mobile(http://m.allrecipes.com)

anybody know please me

go.setonclicklistener(new view.onclicklistener() {              @override             public void onclick(view v) {                 // todo auto-generated method stub                 if (searchtext.gettext().tostring().equalsignorecase("")) {                      alertdialog = new alertdialog.builder(onlinerecipe.this)                             .create();                     alertdialog.settitle("message");                     alertdialog.setmessage("please enter word");                      alertdialog.setbutton("ok",                             new dialoginterface.onclicklistener() {                                 public void onclick(dialoginterface dialog,                                         int which) {                                     // write code here execute after                                     // dialog closed                                     alertdialog.dismiss();                                 }                             });                      // showing alert message                     alertdialog.show();                 } else {                      string url = "http://allrecipes.com/search/default.aspx?qt=k&wt="                             + searchtext.gettext().tostring()                             + "&rt=r&origin=recipe search results";                     webview.getsettings().setjavascriptenabled(true);                     webview.loadurl(url);                   }                }         }); 

if understand correctly, want load http://allrecipes.com in webview in desktop mode... if case, use following code work:

webview.getsettings().setuseragentstring("mozilla/5.0 (windows nt 6.2; wow64) applewebkit/537.31 (khtml, gecko) chrome/20 safari/537.31"); 

this needs placed in code right after part create webview object, webview.

edit: know future reference, line of code changes user agent trick website thinking you're accessing computer instead of phone.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -