[英]How can I detect when a user clicked a particular button of a website loaded inside the webview of my app?
I am loading Amazon website inside the webview of my app and i want to show a toast message when user clicks the Buy Now button in that loaded website.我正在我的应用程序的 webview 中加载亚马逊网站,当用户单击该加载网站中的“立即购买”按钮时,我想显示一条祝酒消息。 What is the way to do perform this task using javascript or any other method available.
使用 javascript 或任何其他可用方法执行此任务的方法是什么。
Try this maybe if you just want to show a message/alert如果您只想显示消息/警报,请尝试此操作
<script>
function showAlert() {
alert ("Hello world!");
}
</script>
And set the buttons onCLick property be this function.并将按钮 onCLick 属性设置为此 function。 For eg.
例如。
function myFunction() { alert("I am an alert box;"); }
<!DOCTYPE html> <html> <body> <h2>JavaScript Alert</h2> <button onclick="myFunction()">Try it</button> </body> </html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.