Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ public AdvWebView(Context context, AttributeSet attrs, int defStyleAttr, int def
private void init() {
// gd = new GestureDetector(context, sogl);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// даём разрешение подгружать несекьюрные ресурсы из assets
getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
// даём разрешение подгружать несекьюрные ресурсы из assets.
// COMPATIBILITY_MODE keeps passive sub-resources (images,
// fonts) loading on https forum pages while blocking active
// mixed content like remote scripts. ALWAYS_ALLOW is the
// strictly less safe option in the WebSettings javadoc.
getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
}
getSettings().setJavaScriptEnabled(true);

Expand All @@ -68,8 +72,13 @@ private void init() {
getSettings().setDomStorageEnabled(true);
getSettings().setAllowFileAccess(true);
getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
getSettings().setAllowFileAccessFromFileURLs(true); //Maybe you don't need this rule
getSettings().setAllowUniversalAccessFromFileURLs(true);
// setAllowFileAccessFromFileURLs / setAllowUniversalAccessFromFileURLs
// only take effect when the WebView is rendering a file:// document.
// AdvWebView loads its HTML with loadDataWithBaseURL on an https
// forum base URL and references bundled resources via
// file:///android_asset/, which is permitted regardless. The two
// flags are not needed for any of the existing WebView paths and
// are a known sandbox-escape vector (CWE-200) when left on.

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2)
getSettings().setPluginState(WebSettings.PluginState.ON);// для воспроизведения видео
Expand Down