0

I have a UWP app using Webview control. The source for the webview is a url for a asp.net web application running on localhost. The url has javascript functions written in it. My question is how can i call javascript function written in web application from the uwp webview control.

<Page
x:Class="signalRonRPi3.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:signalRonRPi3"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<StackPanel>
    <Button x:Name="callJS" HorizontalAlignment="Stretch" Margin="0,0,298,0" Click="callJS_Click" >Call JS</Button>
    <WebView x:Name="webViewUrl" Source="http://localhost:52527/Home/Image" Height="500" Width="500" Margin="50" />
</StackPanel>

How do i call a javascript function written in the source url from here?

1 Answer 1

1

If I understood your question correctly. You want to invoke the Javascript within the source url. In that case you can use InvokeScript method.

You can refer this question on StackOverflow How to invoke javascript functions in a WebView in Universal Windows App to get more details.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.