Comments (5)
Wrap your javascript in a try catch block with the error method and see if anything prints.
try{
// Your Code
}
catch(err){
window.TextSelection.jsError(err);
}
That should log an error in eclipse if there's a javascript error somewhere. Good place to start. Aside from that, send me an example of your html content/custom js and I'll try and take a look.
from btandroidwebviewselection.
Thanks for replying, I have done what you said but still does nothing.
<script type="text/javascript"> try{ prom(); }catch(err){ window.TextSelection.jsError(err); } function prom(){ alert("Function Click!"); } </script>
Here's the OnActionItemClickListener
with little changes.
mContextMenu.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() { public void onItemClick(QuickAction source, int pos, int actionId) { // TODO Auto-generated method stub if (actionId == 1) { // Do Button 1 stuff Log.i(TAG, "Hit Button 1: "); loadUrl("javascript: prom()"); // Here it is, I'm trying to call a javascript function on the html page provided } else if (actionId == 2) { // Do Button 2 stuff Log.i(TAG, "Hit Button 2"); } else if (actionId == 3) { // Do Button 3 stuff Log.i(TAG, "Hit Button 3"); } contextMenuVisible = false; } });
No error is being displayed in my Eclipse log cat from a WebView Tag category. Still I did tried pressing the button but the javascript function in my page wont trigger.
Thanks in advance.
from btandroidwebviewselection.
I just had this problem too. If you're building for Android API 17 or greater you need to add the @JavascriptInterface annotation to the methods in TextSelectionJavascriptInterface, otherwise they're not available to the webview and the javascript fails with "TypeError: Object [Object] has no method 'setContentWidth'".
from btandroidwebviewselection.
Thanks for that. I just updated the class on the master branch with the @JavascriptInterface annotation.
from btandroidwebviewselection.
You're welcome, and thanks for the interesting demo.
from btandroidwebviewselection.
Related Issues (20)
- cursor not visible with gingerbread. HOT 6
- getting the html source from the selection HOT 7
- Selection in webview after zoom and get the selected word using js?
- jquery is not working when loading dynamically HOT 3
- Selection doesn't work on Samsung Galaxy S2 (Android 4.1.2) HOT 1
- how can I set the selection color? how can I change the color? HOT 2
- Add support for localization HOT 2
- Select text in complext web pages HOT 1
- License? HOT 1
- Not working as the data loaded from a web address.
- Not Properly working in Android KItkat HOT 3
- Not working on Galaxy S3
- Selection not working on Samsung Galaxy Tab2 HOT 5
- load Data method is not working HOT 2
- Arabic font problam HOT 1
- Selection works Very Slow
- Selection Problem on using loadDataWithBaseURL to load data HOT 2
- I dont know how to use BTAndroidWebView i tried BTWebView bt=new BTWebView(this); HOT 4
- CAB comes up context menu as well in lollipop device HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from btandroidwebviewselection.