簡體   English   中英

如何檢測用戶何時單擊了我的應用程序的 webview 中加載的網站的特定按鈕?

[英]How can I detect when a user clicked a particular button of a website loaded inside the webview of my app?

我正在我的應用程序的 webview 中加載亞馬遜網站,當用戶單擊該加載網站中的“立即購買”按鈕時,我想顯示一條祝酒消息。 使用 javascript 或任何其他可用方法執行此任務的方法是什么。

如果您只想顯示消息/警報,請嘗試此操作

<script>

  function showAlert() {
    alert ("Hello world!");
  }

</script>

並將按鈕 onCLick 屬性設置為此 function。 例如。

 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM