Last active
August 29, 2015 14:25
-
-
Save marchbold/7249d3b069af5f7255d8 to your computer and use it in GitHub Desktop.
Handling and intercepting location change events in a WebView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here we assume you have previously initialised the extension | |
var webView:WebView = NativeWebView.service.createWebView( new Rectangle( 0, 0, 400, 600 ) ) ; | |
webView.addEventListener( NativeWebViewEvent.LOCATION_CHANGING, webView_locationChangingHandler ); | |
webView.addEventListener( NativeWebViewEvent.LOCATION_CHANGE, webView_locationChangeHandler ); | |
webView.loadURL( "http://airnativeextensions.com" ); | |
... | |
private function webView_locationChangingHandler( event:NativeWebViewEvent ):void | |
{ | |
trace( "location changing to: " + event.data ); | |
// Stop the location change by calling 'event.preventDefault()' | |
event.preventDefault(); | |
} | |
private function webView_locationChangeHandler( event:NativeWebViewEvent ):void | |
{ | |
trace( "location changed to: " + event.data ); | |
} | |
// com.distriqt.NativeWebView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://airnativeextensions.com/extension/com.distriqt.NativeWebView