1

Basically i am opening a web page in Chat bot which is configured over Line messaging application for signup on auth server and after completing signup i tried to close web view using java script but not able to do this below is my code snippet for closing.

<!DOCTYPE html>
<html>
    <head>
      <script>
        function close(){
         window.close(); 
        }
      </script>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width">
      <title>Test Webview Closing</title>
    </head>
    <body>
         <input type="button" value="test" onclick="close()">
    </body>
</html>

2 Answers2

0

Try this.

WebChromeClient webClient = new WebChromeClient(){

public void onCloseWindow(Window w){
    super.onCloseWindow(w);
    Log.d(TAG, "Window close");
 }
};

add webView.setWebChromeClient(webClient); in your application web view code.

vishalk
  • 659
  • 1
  • 4
  • 12
0

you can call java Function from java script in which you can write logic of closing an app.. ref : https://stackoverflow.com/a/10389678/3746306

Nilesh Deokar
  • 2,975
  • 30
  • 53