2013-08-26 3 views
0

페이지가로드되었지만 javascript 페이지가 작동하지 않습니다!왜 webview의 javascript가 작동하지 않습니까?

protected void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState); 
      setContentView(R.layout.activity_poll); 

      Device.webViewShowPoll = (WebView) findViewById(R.id.webViewShowPoll); 

      Device.webViewShowPoll.getSettings().setJavaScriptEnabled(true); 

      //Device.webViewShowPoll.getSettings().setPluginsEnabled(true); 
      Device.webViewShowPoll.getSettings().setJavaScriptEnabled(true); 
      Device.webViewShowPoll.getSettings().setPluginState(PluginState.ON); 
      Device.webViewShowPoll.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); 
      Device.webViewShowPoll.getSettings().setAllowFileAccess(true); 
      Device.webViewShowPoll.addJavascriptInterface(appconnector, "appConnectr"); 

      try 
      { 
       Device.webViewShowPoll.loadDataWithBaseURL("file:///android_asset/", 
         Utility.convertStreamToString(getAssets().open("index.htm", 
           AssetManager.ACCESS_BUFFER)), "text/html", "utf-8",""); 
      } 
      catch (IOException e) 
      { 
       Log.e(getString(R.string.app_name), e.getMessage()); 
      } 
     } 
} 

및 index.htm으로는 다음과 같습니다

<html> 
<head> 
<script type="text/javascript"> 
alert('Hello world!'); 
</script> 
</head> 
<body> 
<p>Hello World!</p> 
<p>Hello World!</p> 
</body> 
</html> 

답변

관련 문제