Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
185
rated 0 times [  192] [ 7]  / answers: 1 / hits: 127618  / 13 Years ago, fri, march 11, 2011, 12:00:00

In my application I am using WebView and in that I am using JavaScript alert( ) method but its not working, no pop-up appears.



in my manifest file I have added



<uses-permission android:name=android.permission.INTERNET></uses-permission>


and in activity file I have added



mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl(file:///android_asset/demo.html);


In layout xml file I have added



<WebView 
android:id=@+id/webview
android:layout_width=fill_parent
android:layout_height=fill_parent
/>


Any clue how to enable full JavaScript in WebView?






Update



Thanks mark

the alert() method in the html file are working now :) .



Now there are two issues in WebView :

1: I am using a <textarea> in the html file that i am loading in WebView , and trying to write in Hindi language font in it, but when i try to write Hindi text it displays as symbols ( rectangle symbols like [] ) .



when i do the same in firefox browser on desktop it works fine.
any clue how to give support for multiple language in textarea in WebView ?



2: When I am clicking submit and trying to open the value of text in alert() method in another java script it doesn't work , does it mean even after using WebChromeClient
its applicable only for current loaded html page and not javascripts called from that page ?


More From » android

 Answers
30

Check this link , and last comment , You have to use WebChromeClient for your purpose.


[#93330] Wednesday, March 9, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
parker

Total Points: 259
Total Questions: 109
Total Answers: 97

Location: Zambia
Member since Thu, Jun 25, 2020
4 Years ago
;