notifyOnPageStarted_ method

void notifyOnPageStarted_(
  1. String url,
  2. bool isNewWindow,
  3. bool isUserInitiated
)

Implementation

void notifyOnPageStarted_(String url, bool isNewWindow, bool isUserInitiated) async {
  // NOTE: in [webview_flutter], every time user click a url will cancel it first,
  //       and ask client by onNavigationRequest().
  //       if client returns cancel, then do nothing
  //       if client returns yes, then call loadUrl(url)

  if (isUserInitiated) {
    bool isAllowed = true;
    if (_widgetState.widget.navigationDelegate != null) {
      WinNavigationDecision decision = await _widgetState.widget.navigationDelegate!(WinNavigationRequest(url, !isNewWindow));
      isAllowed = (decision == WinNavigationDecision.navigate);
    }

    if (isAllowed) loadUrl(url);
    return;
  }

  _currentUrl = url;
  if (_widgetState.widget.onPageStarted != null) {
    _widgetState.widget.onPageStarted!(url);
  }
}