1. 程式人生 > >Webview 如何支援window.open 和window.close

Webview 如何支援window.open 和window.close

WebSettings ws = mWebView.getSettings();
		ws.setJavaScriptEnabled(true); 
		ws.setJavaScriptCanOpenWindowsAutomatically(true);
		ws.setSupportMultipleWindows(true);
class ChromeClient extends WebChromeClient {
		
		@Override
		public void onCloseWindow(WebView window) {
			//TODO something
			super.onCloseWindow(window);
		}

		
		@Override
		public boolean onCreateWindow(WebView view, boolean isDialog,
				boolean isUserGesture, Message resultMsg) {

			//TODO something

			return true;
		}