javascript - Website doesn't load properly on webview -
i have fragment, includes simple webview , textview. i'm trying load site, doesn't load well.
i googled , didn't find solution. think sourch of problem site https://m.headstart.co.il/#/main?id=17863 , don't understand web languages enough understand if problem there. problem? , how can make site load on webview? in advance.
the code block:
view v = inflater.inflate(r.layout.fragment_campaign, container, false); string address_campaign = "http://www.headstart.co.il/project.aspx?id=17863"; webview wv = (webview) v.findviewbyid(r.id.webview); // ui setting // wv.setinitialscale(1); wv.getsettings().setjavascriptenabled(true); wv.getsettings().setloadwithoverviewmode(true); wv.getsettings().setusewideviewport(false); wv.setscrollbarstyle(webview.scrollbars_outside_overlay); wv.setscrollbarfadingenabled(false); // wv.setwebviewclient(new webviewclient()); wv.loadurl(address_campaign); wv.setwebviewclient(new webviewclient() { @override public boolean shouldoverrideurlloading(webview view, string url) { view.loadurl(url); return true; } }); return v;
the xml:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".contackrwbfordonate"> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="help build better community" android:id="@+id/textview4" android:foregroundgravity="top|center_vertical" android:gravity="center" android:textcolor="@color/colorprimary" android:background="@color/backgroundmainactivity" android:layout_gravity="center_horizontal" android:textstyle="bold" /> <webview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/webview" android:layout_gravity="bottom" />
what missing more configuration of webviews settings. guess need allow dom, local data storage , more.
add these permissions , if solve try finding unnecessary ones.
wv.getsettings().setallowcontentaccess(); wv.getsettings().setallowfileaccess(); wv.getsettings().setdatabaseenabled(); wv.getsettings().setdomstorageenabled();
i also suggest try out new api created chrome custom tabs - creating own chrome-tab in app. https://developer.chrome.com/multidevice/android/customtabs
Comments
Post a Comment