Home » Java » java – How to delete SandBoxing from WebView?-Exceptionshub

java – How to delete SandBoxing from WebView?-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

I used HTML file for the live streaming web site

HTML Code:

<script type='text/javascript'>ch='Bein_Sports2'; ch_width=600; ch_height=400;</script><script type='text/javascript' src='https://arembed.com/live.js'></script>     

But the site does not accept SandBoxing where its owner said:

Important: Using sandbox=”allow-forms allow-same-origin allow-scripts ” is prohibited and stream will be blocked if you add that from your website. Please use the provided embedded code.

When WebView is running, The first time the site worked perfectly.

But in the second use i get the message: “Sandboxing is not allowed”

As if WebView added SandBox automatically after the first use.

Java Code:

String myurl = "file:///android_asset/bein"+getIntent().getStringExtra("num")+".html";
WebView view = findViewById(R.id.webView);
view.getSettings().setJavaScriptEnabled(true);
view.getSettings().setSupportMultipleWindows(true);

String newUA= "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50";
view.getSettings().setUserAgentString(newUA);
view.setWebViewClient(new WebViewClient());
view.loadUrl(myurl);
CookieSyncManager.createInstance(this);
CookieSyncManager.getInstance().startSync();
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    CookieManager.getInstance().setAcceptThirdPartyCookies(view, true);
}
view.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        return (event.getAction() == MotionEvent.ACTION_MOVE);
    }
});

Is there a way to delete sandbox from webview or prevent it from being added ?

Or any solution to this problem.

How to&Answers: