简体   繁体   English

如何检测用户何时单击了我的应用程序的 webview 中加载的网站的特定按钮?

[英]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.

相关问题 我怎么能检测到什么时候 <select>点击android webview? - How can i detect when a <select> is clicked in android webview? WebView如何检测按钮是否被单击 - WebView how to detect button is clicked or not 如何确定用户是否点击了我网站上的 Facebook 赞按钮? - How can I find out if a user has clicked the Facebook Like button on my website? 如何检测何时在JQM中单击了无效按钮? - How can I detect when an inactive button is clicked in JQM? 当用户单击链接转到另一个网站时,我该如何请求用户留下。 但是,如果他们要访问我的网站上的其他页面,则没有要求? - How can I request a user to stay, when they clicked a link to go another website. But no request if they want to go another page on my website? 如何检测我的网站/PWA 已加载到前台? - How can I detect that my a website/PWA has been loaded into the foreground? 我希望我的程序能够检测到用户何时通过uiwebview(iphone)单击网站上的“提交”按钮 - I want my program to detect when the user clicks submit button on a website via uiwebview (iphone) 单击按钮时如何重定向到我的网站? - How can I redirect to my website when I click a button? 如何检测用户单击了HTML页面所在的页面选项卡? - How can I detect the user has clicked on the Page Tab where my html page is? 当单击特定元素时,如何检测文本区域何时失去焦点并保持其失去焦点? - How can I detect when a text area loses focus and keep it from losing focus when a particular element is clicked?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM