WebView.ScriptNotify event

Expand
1 out of 1 rated this helpful - Rate this topic

WebView.ScriptNotify event

[This documentation is preliminary and is subject to change.]

Occurs when the content contained in the WebView control passes a string to the application by using JavaScript.

Syntax


public event NotifyEventHandler ScriptNotify


<WebView ScriptNotify="eventhandler"/>


Event information

Delegate NotifyEventHandler

Examples

The following code example demonstrates the use of the ScriptNotify event.


public MyPage()
{
    this.InitializeComponent();
    MyWebView.ScriptNotify += MyWebView_ScriptNotify;

    // Here we have to set the AllowedScriptNotifyUri property because we are 
    // navigating to some site where we don't own the content and we want to 
    // allow window.external.notify() to pass data back to the app.
    List<Uri> allowedUris = new List<Uri>();
    allowedUris.Add(new Uri("http://www.bing.com"));
    MyWebView.AllowedScriptNotifyUris = allowedUris;
}

void MyWebView_ScriptNotify(object sender, NotifyEventArgs e)
{
    // Respond to the script notification.
}


Requirements

Minimum supported client

Windows 8 Release Preview

Minimum supported server

Windows Server 2012

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

WebView

 

 

Build date: 5/22/2012

Did you find this helpful?
(1500 characters remaining)
Community Additions ADD
Re: Synergist

try "window.external.notify('Hello Tellus');"

5/5/2012
How does the HTML trigger ScriptNotify?
How does JS on an HTML page trigger the ScriptNotify event?
4/6/2012