我试图将JQuery文件包含在资源/脚本和Internet中,但不会显示警报对话框。我得到了日志输出并使其成为output.html,它在Windows中工作(很奇怪!)。
WebView有什么问题?
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
webView = (WebView) findViewById(R.id.webView);
final String s = "
" +"" +
"" +
"" +
"
"$(document).ready(function(){ alert('hello'); });" +
"" +
"
"Falling on the rooftop. Oh baby tell me why you have to go. " +
"Cause this pain I feel you won't go away. And today, " +
"I'm officially missing you.
webView.getSettings().setJavaScriptEnabled(true);
Log.d("Something", s);
webView.loadDataWithBaseURL("file:///android_asset/", s, "text/html", "utf-8", null);
}
这是添加扩展名“.html”后的日志输出。它适用于Firefox,但不适用于WebView。 🙁
All I hear is raindrops.Falling on the rooftop. Oh baby tell me why you have to go. Cause this pain I feel you won't go away. And today, I'm officially missing you.