From the course: .NET 9 Maui: Enhanced Features for Cross-Platform Development
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
HybridWebView calling JavaScript from C#
From the course: .NET 9 Maui: Enhanced Features for Cross-Platform Development
HybridWebView calling JavaScript from C#
- [Narrator] One of the important capabilities of the HybridWebView is the ability to call JavaScript from C#. To do this is relatively easy once we know how to do it, However, there are some steps that need to be taken for it to work correctly. The first thing we need to do to allow JavaScript to be called from C#, or to call C# from JavaScript, is to add a JavaScript file to the project. And we're going to start by adding a folder to it. And we're going to do this right under our ww root folder, and we'll right-click and go Add New Folder. And we're going to call it scripts. And inside scripts we're going to add a new file. Now, normally I'd add a new JavaScript file. I don't actually have the web workload installed, so that doesn't show up for us. So I'm just going to change this JSON file right here. And we're just going to call it HybridWebView.js And we're going to clean out the content of this, and make it an empty JavaScript file, and hit Save. Now what needs to be in this…
Contents
-
-
-
(Locked)
What is this update all about?3m 45s
-
HybridWebView control5m 27s
-
(Locked)
HybridWebView calling JavaScript from C#6m 44s
-
HybridWebView calling JavaScript and calling C#6m 16s
-
(Locked)
Titlebar for Windows5m
-
(Locked)
Titlebar for Windows customizations5m 33s
-
(Locked)
BlazorWebView behavior changes4m 58s
-
(Locked)
CollectionView/CarouselView for Apple devices5m 50s
-
(Locked)
SoftKeyboard input2m 59s
-
(Locked)
Text justification2m 47s
-
(Locked)
TimePicker TimeSelected event5m 22s
-
(Locked)
WebView ProcessTerminated event5m 47s
-
(Locked)
-
-
-
-
-