uwp Using JavaScript in WebView

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

This document shows you how you can use JavaScript in WebView.

This document cover: Getting HTML from the WebView, Entering text in the text box on the website, Simulate click to click a website button

Syntax

  • await webView.InvokeScriptAsync("eval", new string[] { functionString }) - to use JavaScript
  • .documentElement - to get a reference to the root node of the document
  • .getElementsByClassName(Class_Name) - to get elements usign Class Name
  • .getElementsByTagName(Tab_Name) - to get elements using Tag Name
  • .getElementById(ID) - to get element using ID
  • .nodeName - to get the node name
  • .childNodes - to get the child elements
  • .outerHTML - to Get the Outer HTML
  • .innerHTML - to Get the Inner HTML
  • .innerText - to Get or Set InnerText
  • .click() - to Simulate click

Remarks



Got any uwp Question?